From 5c3180ffa074c3ade9647e958ea3d0bbbe099f16 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 19 Sep 2024 17:25:09 +0100 Subject: [PATCH] Removed duplicate code Signed-off-by: snipe --- app/Http/Controllers/Api/AssetMaintenancesController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/AssetMaintenancesController.php b/app/Http/Controllers/Api/AssetMaintenancesController.php index 6386f04a9d..58b1402df4 100644 --- a/app/Http/Controllers/Api/AssetMaintenancesController.php +++ b/app/Http/Controllers/Api/AssetMaintenancesController.php @@ -48,6 +48,10 @@ class AssetMaintenancesController extends Controller $maintenances->where('asset_maintenances.supplier_id', '=', $request->input('supplier_id')); } + if ($request->filled('created_by')) { + $maintenances->where('asset_maintenances.created_by', '=', $request->input('created_by')); + } + if ($request->filled('asset_maintenance_type')) { $maintenances->where('asset_maintenance_type', '=', $request->input('asset_maintenance_type')); } @@ -97,9 +101,6 @@ class AssetMaintenancesController extends Controller case 'status_label': $maintenances = $maintenances->OrderStatusName($order); break; - case 'created_by': - $maintenances = $maintenances->OrderByCreatedBy($order); - break; default: $maintenances = $maintenances->orderBy($sort, $order); break;