title: Laravel search among relations
body: <p>I have a bit of code failing to achieve what I'm looking for. Auth User if owner of a company who owns clients, and clients buy product.</p>
  
  <p>Basically I want to create a search amongs clients of the desired company (well user owned company) and potentially on products bought :</p>
  
  <p>I tried this :</p>
  
  <pre><code>$clients_paginate = Auth::user()-&gt;company-&gt;clients();
  if($q != ""){
      $clients_paginate-&gt;where("user_prenom", 'like', '%' . $q . '%')
         -&gt;orWhere("user_nom", 'like', '%' . $q . '%'
         -&gt;orWhere("societe_nom", 'like', '%' . $q . '%');
  }
  </code></pre>
  
  <p>The problem I have is that it retrieves clients responding to query but which are not owned by the given company ! I thought the query would be restrained by the first relationship ->clients() but not the case !!!</p>
  
  <p>Is there a way to cope the problem</p>