title: Eloquent Nested relations with where clause query returns collection on false condition
body: <p>I am trying to search for all Rents that have a RentItem with a book title LIKE the given $input. </p>
  
  <p>The problem is when the input does not match,I still get a collection returned.
  The only difference is that the book relation is null instead of a collection.</p>
  
  <p>Result of query that should return false:
  <a href="https://pastebin.com/pd7UqhCi" rel="noreferrer">https://pastebin.com/pd7UqhCi</a></p>
  
  <p>Result of query that is true:
  <a href="https://pastebin.com/shndvdMh" rel="noreferrer">https://pastebin.com/shndvdMh</a></p>
  
  <p>When book equals null, I do not want the Rent model to be returned.</p>
  
  <p>My query</p>
  
  <pre><code>$rents = Rent::with(['rentItems.book' =&gt; function ($query) use ($input) { 
         $query-&gt;where('books.title', 'LIKE', "%$input%"); 
  }])-&gt;get();
  </code></pre>
  
  <p>Rent model Relation</p>
  
  <pre><code>public function rentItems()
  {
    return $this-&gt;hasMany(RentItem::class);
  }
  </code></pre>
  
  <p>RentItems model Relations</p>
  
  <pre><code>public function book()
  {
       return $this-&gt;belongsTo(Book::class);
  }
  
  public function rent()
  {
       return $this-&gt;belongsTo(Rent::class);
  }
  </code></pre>
  
  <p>Research i have done:</p>
  
  <ul>
  <li><a href="https://laracasts.com/discuss/channels/laravel/eloquent-nested-relations-with-where-clause" rel="noreferrer">https://laracasts.com/discuss/channels/laravel/eloquent-nested-relations-with-where-clause</a></li>
  <li><a href="https://laracasts.com/discuss/channels/eloquent/using-wherehas-and-with" rel="noreferrer">https://laracasts.com/discuss/channels/eloquent/using-wherehas-and-with</a></li>
  <li><a href="https://laravel.com/docs/5.6/eloquent-relationships#constraining-eager-loads" rel="noreferrer">https://laravel.com/docs/5.6/eloquent-relationships#constraining-eager-loads</a></li>
  </ul>