laravel order by
作者:互联网
orderBy(\DB::Raw('case when avatar_id = 0 then 0 else 1 end'))
Doctor::join('users', 'doctors.user_id', '=', 'users.id') ->with('user') ->withCount('services', 'notebooks') ->orderByDesc('notebooks_count') ->orderByDesc('services_count') ->orderBy(\DB::Raw('case when avatar_id is null then 0 else 1 end')) ->where('status', 1);
标签:laravel,orderBy,end,when,notebooks,DB,id,order 来源: https://www.cnblogs.com/fenle/p/11613899.html