title: Laravel / hasMany / 3 tables single callback
body: <p>I have 3 tables like so: </p>
  
  <pre><code>User:
  - user_id
  - name
  
  Location_user:
  - loc_id
  - loc_loc_id
  - loc_user_id
  
  Location:
  - location_id
  - location_name
  </code></pre>
  
  <p>So the users may belong to 4 locations so the "location_user" table will hold 4 records for that user. </p>
  
  <p>At the moment I can call the users and get back a list of there locations but on an ID only basis using: </p>
  
  <pre><code>public function locations()
  {
      return $this-&gt;hasMany('App\Location_user', 'loc_user_id');
  }
  </code></pre>
  
  <p>As I said this will come back with all the locations this user belongs too but I want to get the names of those location instead of the ID's or even both. </p>
  
  <p>Any ideas? I am fairly new to laravel still so not had to do this yet. </p>
  
  <p>EDIT: </p>
  
  <p>Called by:
       $results = User::with('locations')->get();</p>