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);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM