Eloquent also lets you query on defined relationships, as show below:
User::whereHas('articles', function (Builder $query) {
$query->where('published', '!=', true);
})->get();
This requires that your relationship method name is articles in this case. The argument passed into the clos...