title: Fetching and filtering relations in Laravel Eloquent
body: <p>I have the following models in Eloquent: groups, threads, comments and users. I want to find all comments in a specific group from a specific user.</p>
  
  <p>This is my current approach:</p>
  
  <pre><code>$group-&gt;threads-&gt;each(function ($thread) use ($user_id)
  {
    $user_comments = $thread-&gt;comments-&gt;filter(function ($comment) use ($user_id)
    {
      return $comment-&gt;owner_id == $id;
    });
  });
  </code></pre>
  
  <p>This looks ugly as hell, is probably slow as hell, and I just want to get rid of it. What is the fastest and most elegant way in Eloquent to get to my result set?</p>