title: API - Handling Nested Resources (Laravel)
body: <p>In Laravel (with Fractal Transformers), I'm trying to figure out how to handle nested resources exactly.  Lets say I have these routes:</p>
  
  <pre><code>Route::resource('user', 'UserController');
  Route::resource('user.activity', 'UserActivityController');
  </code></pre>
  
  <p>So if I wanted to get all users, the uri is <code>/user</code>,  And if I want User 5, it's <code>/user/5</code></p>
  
  <p>Now, if I want the Activity for a User, the uri is <code>user/1/activity</code>.</p>
  
  <p>Here's where I get a little confused.  In the <code>UserActivityController</code>, you might have:</p>
  
  <pre><code>public function index($user_id)
  {
      $user = $this-&gt;user-&gt;find($user_id)-&gt;activity;
      return $this-&gt;respondWithItem($user, $this-&gt;transformer);
  }
  </code></pre>
  
  <p>So here's what I'm confused about:</p>
  
  <p>1) For each nested resource, do I keep fetching the top parent resource (<code>User</code> in this case)?  Lets say <code>user</code> has nested resources 3 or 4 levels deep (i.e. <code>/user/1/activity/5/mentions/6/somethng-else</code>)?  Does each Resource Controller just need to keep starting from the top and working down?</p>
  
  <p>2) As I'm using Fractal, is has support for <code>includes</code> which allows me to load related data as needed by appending certain data to <code>includes</code> in the query string.  In fact, it's so flexible that I feel I could use a base (like <code>User</code>) and get every other bit of data I need from clever <code>include</code> usage.  So, is it preferable to just do this rather than using sub resources and sub resource controllers?</p>