// Retrieve all posts that have at least one comment...
$posts = App\Post::has('comments')->get();
// Retrieve all posts that have three or more comments...
$posts = App\Post::has('comments', '>=', 3)->get();
// Retrieve all posts that have at least one comment with votes...
$posts = App\Post::has('comments.votes')->get();
// Retrieve all posts with at least one comment containing words like foo%
$posts = App\Post::whereHas('comments', function ($query) {
$query->where('content', 'like', 'foo%');
})->get();