Snippet

Eloquent order by related column

Updated on: August 23, 2023

Coming Soon Laravel eloquent order by cheatsheet.

$users = User::query()
    ->orderBy('posts_count', 'asc')
    ->get();