title: Laravel 5.0 ORM Relations
body: <p>I'm trying to select a 'Site' from a Users 'Organisation'.
  I can successfuly retrieve a User's Organisation (as an Organisation object) by using </p>
  
  <pre><code>$user-&gt;organisation
  </code></pre>
  
  <p>but when I try to retrieve the sites belonging to the organisation using:</p>
  
  <pre><code>$user-&gt;organisation-&gt;sites
  </code></pre>
  
  <p>I get every site in my DB returned (as a collection).</p>
  
  <p>My User Model's organisation relationship:</p>
  
  <pre><code>public function organisation()
  {
      return $this-&gt;belongsTo('App\Models\Organisation', 'organisation_id');
  }
  </code></pre>
  
  <p>My Organisation Model's User and Site relationships:</p>
  
  <pre><code>public function users()
  {
      return $this-&gt;hasMany('App\Models\User');
  }
  
  public function sites()
  {
      return $this-&gt;hasMany('App\Models\Site');
  }
  </code></pre>
  
  <p>My Site Model's Organisation relationship:</p>
  
  <pre><code>public function organisation()
  {
      return $this-&gt;belongsTo('App\Models\Organisation');
  }
  </code></pre>
  
  <p><strong>User Table</strong></p>
  
  <ul>
  <li>id </li>
  <li>organisation_id</li>
  <li>name</li>
  <li>email</li>
  <li>password</li>
  <li>last_login</li>
  <li>persist_code</li>
  <li>reset_password_code</li>
  <li>remember_token</li>
  <li>created_at</li>
  <li>updated_at</li>
  <li>deleted_at</li>
  <li>responsible_to</li>
  </ul>
  
  <p><strong>Organisations</strong></p>
  
  <ul>
  <li>id</li>
  <li>name</li>
  <li>created_at</li>
  <li>updated_at</li>
  <li>deleted_at</li>
  </ul>
  
  <p><strong>Sites</strong></p>
  
  <ul>
  <li>id</li>
  <li>organisation_id</li>
  <li>name</li>
  <li>address</li>
  <li>account_code</li>
  <li>created_at</li>
  <li>updated_at</li>
  <li>deleted_at</li>
  </ul>
  
  <p>I've included everything I think will be useful here but I've missed anything I will add it as requested.</p>
  
  <p>I have the following workaround in place but I am still unhappy with why the above is not working as expected.</p>
  
  <pre><code>$organisation = Organisation::where('id', $user-&gt;organisation-&gt;id)-&gt;first();
  $site = Site::where('organisation_id', $organisation-&gt;id)-&gt;first();
  </code></pre>
  
  <p>The above workaround returns the first site from my table that does genuinely have a relationship with my user model.</p>
  
  <p>If I remove <code>-&gt;first()</code> I get a collection of sites that are associated with my user through the organisation rather than all from the table.</p>
  
  <p>Thanks</p>