title: Relations in resources?
body: <p>So I'm planning to start using <a href="https://laravel.com/docs/5.5/eloquent-resources" rel="nofollow noreferrer">resources</a> for my "API" (vue endpoint). So I started to search for some tutorials about the subject, and found a youtuber that describes the process. And I started making my own API resource. The youtuber shows briefly <a href="https://youtu.be/Gyr5ZMNaPbc?t=22m15s" rel="nofollow noreferrer">how to use the relations</a>, but the thing is that I receive <code>Property [description] does not exist on this collection instance.</code> when trying to use the relation in the resource.</p>
  
  <p>The current setup is:</p>
  
  <pre><code>$stack = Stack::select(['id', 'name', 'subject_id', 'description', 'image'])-&gt;where('id', '=', $requestId)-&gt;first();
  $questions = $stack-&gt;load('question.choiceInRandomOrder');
  
  return $questions;
  </code></pre>
  
  <p>And with resource it would be something like (notice <code>choiceInRandomOrde</code>, I would need that relation also):</p>
  
  <pre><code>return [
     'subject' =&gt; $this-&gt;subject-&gt;name,
     'name' =&gt; $this-&gt;name,
     'slug' =&gt; $this-&gt;slug,
     'description' =&gt; $this-&gt;description,
     'image' =&gt; $this-&gt;image,
     'questions' =&gt; [
         'description' =&gt; $this-&gt;question-&gt;description,
         'is_info' =&gt; $this-&gt;question-&gt;is_info,
         'source' =&gt; $this-&gt;question-&gt;source,
         'image' =&gt; $this-&gt;question-&gt;image,
        ]
     ];
  }
  </code></pre>
  
  <p>And for testing, I have setup the following in my routes <code>web.php</code></p>
  
  <pre><code>use App\Stack;
  use App\Http\Resources\StackResource;
  
  Route::get('/json', function(){
      $stack = Stack::find(2);
      return new StackResource($stack);
  });
  </code></pre>