title: LARAVEL - How to create an indirect relation between 3 models
body: <p>I have 3 Models: User, Pet and Clinic.</p>
  
  <p>Let's assume the tables: users, pets and clinics. The relation is, one user can have more than one pet, and one pet only have one clinic.</p>
  
  <p>On the table "Pets" i have a FK to the user_id and another one to the clinic_id.</p>
  
  <p>I want to do something like:</p>
  
  <pre><code>$user-&gt;clinics(); 
  </code></pre>
  
  <p>on the User model to return all the distinct clinics associated with the user. Now i can only do:</p>
  
  <pre><code>$user-&gt;pets()-&gt;with('clinics); 
  </code></pre>
  
  <p>but i want to return only the distinct clinics.</p>
  
  <p>User modal:</p>
  
  <pre><code>public function pets()
  {
      return $this-&gt;hasMany('Petable\Models\Pet', 'user_id', 'id');
  }
  </code></pre>
  
  <p>Pet modal:</p>
  
  <pre><code>public function clinic()
  {
      return $this-&gt;belongsTo('Petable\Models\Clinic', 'clinic_id', 'id');
  }
  </code></pre>
  
  <p>Any suggestion ? </p>