title: Laravel eloquent and relationship
body: <p>I have a code:</p>
  
  <pre><code>$response = $this-&gt;posts
      -&gt;where('author_id', '=', 1)
      -&gt;with(array('postComments' =&gt; function($query) {
          $query-&gt;where('comment_type', '=', 1);
      }))
      -&gt;orderBy('created_at', 'DESC')
      -&gt;limit($itemno)
      -&gt;get();
  </code></pre>
  
  <p>And when I logged this query with:</p>
  
  <pre><code>$queries = \DB::getQueryLog();
  $last_query = end($queries);
  \Log::info($last_query);
  </code></pre>
  
  <p>In log file I see follow:</p>
  
  <pre><code>"select * from `post_comments` where `post_comments`.`post_id` in (?, ?, ?, ?) and `comment_type` &lt;&gt; ?"
  </code></pre>
  
  <p>Why is the question mark for comment_type in the query?</p>
  
  <p><strong>Update #1:</strong></p>
  
  <p>I replaced current code with following and I get what I want. But I'm not sure it is OK. Maybe exists many better, nicer solution.</p>
  
  <pre><code>$response = $this-&gt;posts
      -&gt;where('author_id', '=', 1)
      -&gt;join('post_comments', 'post_comments.post_id', '=', 'posts.id')
      -&gt;where('comment_type', '=', 1)
      -&gt;orderBy('created_at', 'DESC')
      -&gt;limit($itemno)
      -&gt;get();
  </code></pre>