title: Eloquent Relation Filtering
body: <p>Is it possible to filter a result set in Laravel's Eloquent ORM by related models?  I understand that Eloquent does not join tables but the results I would like would be similar to:</p>
  
  <blockquote>
    <p>SELECT * 
    FROM tickets 
    JOIN statuses on tickets.status_id = statuses.id
    WHERE statuses.name != 'Closed';</p>
  </blockquote>
  
  <p>The closest functionality I have found in Eloquent is:</p>
  
  <pre><code>$tickets = Ticket::with(array('status' =&gt; function($q) {
      return $q-&gt;where('name', '!=', 'Closed');
  }))-&gt;get();
  </code></pre>
  
  <p>This will still return all of the tickets but only the statuses relation if the name is not closed.</p>
  
  <p>Also, I know this can be done in Fluent, but I would like to work with the returned structure of nested objects that Eloquent provides:</p>
  
  <pre><code>echo ticket-&gt;status-&gt;name;
  </code></pre>
  
  <p>Fluent returns a flattened result as a joined query would.</p>