orderby textwerte eliquent laravel
orderByRaw("FIELD(clan_rank , 'Owner', 'Admin', 'Member') ASC");
Splendid Stoat
orderByRaw("FIELD(clan_rank , 'Owner', 'Admin', 'Member') ASC");
$order = 'desc';
$users = User::join('roles', 'users.role_id', '=', 'roles.id')->orderBy('roles.label', $order)->select('users.*')->paginate(10);
select('forum_posts.*')->orderByRaw('...')
// or
Post::query()->select('forum_posts.*')->orderByDesc(
Post::where() ...
)
// or
Post::query()->select('forum_posts.*')->orderBy(DB::raw('...'));