laravel order by

Posted jzfan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 order by的主要内容,如果未能解决你的问题,请参考以下文章