title: Laravel hasOneThrough - Laravel relationships
body: <p>I really need help with the following! I am trying to understand how <code>hasOneThrough</code> works</p>
  
  <p><strong>Users table:</strong></p>
  
  <p>id | belongs_to (id of the company) </p>
  
  <p><strong>Companies Table:</strong></p>
  
  <p>id | country_id</p>
  
  <p><strong>Countries table:</strong></p>
  
  <p>id </p>
  
  <p>So I would like to know the country ID of a user through the Company... in <strong>User</strong> model I am trying the following:</p>
  
  <pre><code>public function country() {
          return $this-&gt;hasOneThrough(
              'App\Countries',
              'App\Companies',
              'country_id', // the name of the foreign key on the intermediate model...
              'id', // is the name of the foreign key on the final model...
              'belongs_to', // is the local key...
              'id' // is the local key of the intermediate model...
          );
      }
  </code></pre>
  
  <p>Also tried</p>
  
  <pre><code>public function country() {
          return $this-&gt;hasOneThrough(
              'App\Countries',
              'App\Companies',
              'country_id', // the name of the foreign key on the intermediate model...
              'belongs_to', // is the name of the foreign key on the final model...
              'id', // is the local key...
              'id' // is the local key of the intermediate model...
          );
      }
  </code></pre>
  
  <p>But always get <code>NULL</code> as result</p>