``` $mostPopularWriters = Developer::whereHas('posts', function (Builder $query) { $query->where('likes', '>=', 10); })->get(); ``` becomes ``` $mostPopularWriters = Developer::whereRelation('posts', 'likes', '>=', 10)->get(); ``` Nick Ciolpan 09 Dec 2021« Back to post