diff --git a/app/Services/Cartables/Mission/Report/ReportMachineService.php b/app/Services/Cartables/Mission/Report/ReportMachineService.php index 58f65c82..a00501cb 100644 --- a/app/Services/Cartables/Mission/Report/ReportMachineService.php +++ b/app/Services/Cartables/Mission/Report/ReportMachineService.php @@ -22,13 +22,14 @@ class ReportMachineService ] ); } + public function machinesActivity(Request $request): array { $query = Mission::query() ->join('cmms_machines as cm', 'cm.id', '=', 'missions.machine_id') ->where('state_id', '=', 4) ->when($request->province_id, function ($q) use ($request) { - $q->where('missions.province_id', $request->province_id); + $q->where('missions.province_id', '=', $request->province_id); }) ->selectRaw( 'cm.car_name, @@ -51,7 +52,7 @@ class ReportMachineService public function dataTableMachineTypesActivity(Request $request,int $car_type): array { - $machineIds = CMMSMachine::query()->where('car_type', '=', $request->query('car_type'))->pluck('machine_id'); + $machineIds = CMMSMachine::query()->where('car_type', '=', $car_type)->pluck('machine_id'); return DataTableFacade::run( Mission::query()->whereIn('machine_id', $machineIds), $request,