laravel/framework — pull request #4237 by jarektkaczyk (2014-04-23 22:56:19+00:00)
Title: Fix / Improve has for nested relations

This fix allows you to use dot nested relations in **Eloquent Builder's** *has()* method (and derivatives like *whereHas()* etc).

Currently this would not work:
```
User::has('categories.posts.comments')->get();
```
Instead you have to use a bit cumbersome nesting:
```
User::whereHas('categories', function ($q) {
$q->whereHas('posts', function ($q) {
$q->has('comments');
});
})->get();
```

With this fix the first line runs exactly the same query as the second block, but uses nice and easy syntax adequate to the entire Eloquent.