Laravel Orderby not working inside Eloquent whereHas relationship?
问题 Please have look on below code. $serviceNew = CompletedService::selectRaw('gallons_collected as total,account_id,id,service_provider_id,service_id,service_date') ->where("service_id", '1')->where('service_provider_id', $service_privider_id)->whereMonth('service_date', $month)->whereYear('service_date', $year) ->with('account') ->whereHas('account', function($qs) { $qs->orderBy('restaurant_name', 'DESC'); }) ->get(); I have multiple records in "CompletedService" and there is one parent id