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