How to use order by query both with current table column and relationship table column in laravel?
问题 i am trying to fetch record with order by query but situation is this that i have to use order by both on current table column and relationship table column in laravel . I tried this $consignments = Consignment::where('delivery_run_id', $id)->whereIn('status', [ 'In Warehouse', 'With On Forwarder', 'In Transit (Warehouse->Delivery)', 'Awaiting Pickup' ])->with(['consignment_run_sheet' => function ($query) { $query->orderBy('run_sheet_id'); }])->orderBy('delivery_date', 'DESC')->get();