title: How to use eager load with constraints correctly in Laravel 4
body: <p>I am using laravel4 with eloquent and have some problems with the eager loading issue. From the documentation on the official site <a href="http://laravel.com/docs/eloquent#eager-loading" rel="nofollow">http://laravel.com/docs/eloquent#eager-loading</a> the eager loading is used in the following way: </p>
  
  <pre><code>$organizations = Organization::with(array('groups' =&gt; function($query) use ($groupIds)
  {
     $query-&gt;where('name', '=', 'HQ_Admins');
  ))-&gt;get();
  </code></pre>
  
  <p>This is an example code from my application. The eager loading in generally works, I get all organizations with the groups belonging to them. The problem is that I specified a where clause like in the example code above and this seemes not to work. I did everything but eloquent doesn't register the where clause. I also tried some things to get the native SQL query and experimented with some things, but at the end the result isn't like I expect. Had anyone experience with a similar problem ?</p>
  
  <p>Thanks</p>