title: How to get Response variables in a Laravel PHPUnit test?
body: <p>I am testing a controller method and I am accessing a route in a test.</p>
  
  <p>Then I would like to make sure that the correct model was returned in the view and was loaded with all of the correct relationships.</p>
  
  <p>I know that I can do this:</p>
  
  <pre><code>$this-&gt;assertViewHas("content");
  </code></pre>
  
  <p>But can how can I verify that the content model that was returned into the view has the correct, for example, category? i.e. how can I get the content model object and then do something like</p>
  
  <pre><code>$this-&gt;assertEquals($content-&gt;category-&gt;name, "category 1");
  </code></pre>
  
  <p>?</p>