码迷,mamicode.com
首页 > 其他好文 > 详细

laravel order by

时间:2019-09-30 19:42:59      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:cas   when   users   doc   case   not   vat   books   erb   


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

标签:cas   when   users   doc   case   not   vat   books   erb   

原文地址:https://www.cnblogs.com/fenle/p/11613899.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!