title: Eloquent query where column is in another table
body: <p>I have two tables, <code>posts</code> and <code>likes</code>. I need to create a query, <em>using Eloquent</em>, that gets all posts that have been liked by a specific <code>user_id</code>.</p>
  
  <p>In other words, it should be something like this:</p>
  
  <pre><code>SELECT * FROM posts p LEFT JOIN likes l ON p.id = l.post_id WHERE l.user_id = 2 ORDER BY l.created_at DESC
  </code></pre>
  
  <p><code>posts</code> table:</p>
  
  <pre><code>+----+---------+------------+-------------+
  | id | user_id |  message   | created_at  |
  +----+---------+------------+-------------+
  |  1 |       2 | Hello!     | &lt;SOME TIME&gt; |
  |  2 |       3 | World!     | &lt;SOME TIME&gt; |
  |  3 |       2 | Something. | &lt;SOME TIME&gt; |
  |  4 |       2 | Another.   | &lt;SOME TIME&gt; |
  +----+---------+------------+-------------+
  </code></pre>
  
  <p><code>likes</code> table:</p>
  
  <pre><code>+----+---------+---------+-------------+
  | id | post_id | user_id | created_at  |
  +----+---------+---------+-------------+
  |  1 |       1 |       2 | &lt;SOME TIME&gt; |
  |  2 |       2 |       2 | &lt;SOME TIME&gt; |
  |  3 |       1 |       3 | &lt;SOME TIME&gt; |
  |  4 |       3 |       2 | &lt;SOME TIME&gt; |
  +----+---------+---------+-------------+
  </code></pre>
  
  <p>Here is my <code>Post</code>class:</p>
  
  <pre><code>&lt;?php
  
  class Post extends Eloquent {
  
      protected $table = 'posts';
  
      public function likes()
      {
          return $this-&gt;hasMany('Like');
      }
  
  }
  </code></pre>
  
  <p>And the <code>Like</code> class:</p>
  
  <pre><code>&lt;?php
  
  class Like extends Eloquent {
  
      protected $table = 'likes';
  
  
      public function post()
      {
          return $this-&gt;belongsTo('Post');
      }
  
  }
  </code></pre>
  
  <p>How can I do this?</p>