title: Laravel 5 eloquent with whereHas more than 3. How to?
body: <p>it seems that it does not work, when I'm using  "with" and function inside it and later trying to use "has" function. Here's the code, it should be easier to understand:</p>
  
  <pre><code>$users = Users::where("active","=", "1")-&gt;with(['photos' =&gt; function($q){
              $q-&gt;where('type','!=', 2);
         }])-&gt;has('photos', '&gt;', 3)-&gt;paginate(8);
  }
  </code></pre>
  
  <p>It seems, that it should return user ONLY if he has 3 photos which are NOT of type 2. But it doesn't care about "where" clause and return it without checking to the type.</p>
  
  <p>How can I achieve what I'm seeking? </p>
  
  <p>Thank you!</p>