diff --git a/app/Enums/MachineStates.php b/app/Enums/MachineStates.php new file mode 100644 index 00000000..ccdd6e2e --- /dev/null +++ b/app/Enums/MachineStates.php @@ -0,0 +1,19 @@ + 'اماده به کار', + self::REZERV => 'رزرو', + self::DAR_HAL_MAMOREAT => 'در حال ماموریت', + }; + } +} \ No newline at end of file diff --git a/app/Http/Controllers/V3/CMMSMachinesController.php b/app/Http/Controllers/V3/CMMSMachinesController.php index b74be799..d0819a1a 100644 --- a/app/Http/Controllers/V3/CMMSMachinesController.php +++ b/app/Http/Controllers/V3/CMMSMachinesController.php @@ -22,13 +22,13 @@ class CMMSMachinesController extends Controller $request, allowedFilters: ['*'], allowedSortings: ['*'], - allowedSelects: ['machine_code', 'id', 'plak_number', 'car_name', 'car_type'] + allowedSelects: ['machine_code', 'id', 'plak_number', 'car_name', 'car_type', 'status'], )); } public function list(): JsonResponse { - $machinesList = CMMSMachine::query()->get(['machine_code', 'id', 'plak_number', 'car_name', 'car_type']); + $machinesList = CMMSMachine::query()->get(['machine_code', 'id', 'plak_number', 'car_name', 'car_type', 'status']); return $this->successResponse($machinesList); } @@ -37,7 +37,7 @@ class CMMSMachinesController extends Controller { $matchedSearchedMachines = CMMSMachine::query() ->where('machine_code', 'LIKE', "%{$request->machine_code}%") - ->get(['machine_code', 'id', 'plak_number', 'car_name']); + ->get(['machine_code', 'id', 'plak_number', 'car_name', 'status']); return $this->successResponse($matchedSearchedMachines); } diff --git a/database/migrations/2025_10_19_152736_add_status_to_cmms_machines_table.php b/database/migrations/2025_10_19_152736_add_status_to_cmms_machines_table.php new file mode 100644 index 00000000..60dbf9f3 --- /dev/null +++ b/database/migrations/2025_10_19_152736_add_status_to_cmms_machines_table.php @@ -0,0 +1,28 @@ +integer('status')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('cmms_machines', function (Blueprint $table) { + $table->dropColumn('status'); + }); + } +};