Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel query order by relation

$order = 'desc';
$users = User::join('roles', 'users.role_id', '=', 'roles.id')->orderBy('roles.label', $order)->select('users.*')->paginate(10);
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #laravel #query #order #relation
ADD COMMENT
Topic
Name
4+4 =