From b507e706d0d1449a8661a90e815b8ff361a2eca6 Mon Sep 17 00:00:00 2001 From: amirghasempoor Date: Tue, 31 Dec 2024 11:11:12 +0330 Subject: [PATCH 1/7] add activity for azmayesh --- .../V3/Azmayesh/AzmayeshController.php | 6 ++++++ .../V3/Azmayesh/AzmayeshTypeController.php | 6 ++++++ app/Http/Controllers/V3/ProfileController.php | 2 +- .../V3/RoadPatrolProjectController.php | 8 ++++---- .../V3/RoadPatrolProject/StoreRequest.php | 19 ++++++++++++------- storage/sql-files/log_lists.sql | 12 ++++++++++++ 6 files changed, 41 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/V3/Azmayesh/AzmayeshController.php b/app/Http/Controllers/V3/Azmayesh/AzmayeshController.php index 83802ce4..fb3fd81b 100644 --- a/app/Http/Controllers/V3/Azmayesh/AzmayeshController.php +++ b/app/Http/Controllers/V3/Azmayesh/AzmayeshController.php @@ -84,6 +84,8 @@ class AzmayeshController extends Controller 'contract_subitem_id' => $request->contract_subitem_id ]); + $user->addActivityComplete(1158); + return $this->successResponse(); } @@ -122,6 +124,8 @@ class AzmayeshController extends Controller 'contract_subitem_id' => $request->contract_subitem_id ]); + auth()->user()->addActivityComplete(1159); + return $this->successResponse(); } @@ -133,6 +137,8 @@ class AzmayeshController extends Controller try { $azmayesh->delete(); + auth()->user()->addActivityComplete(1160); + return $this->successResponse(); } catch (QueryException $exception) { diff --git a/app/Http/Controllers/V3/Azmayesh/AzmayeshTypeController.php b/app/Http/Controllers/V3/Azmayesh/AzmayeshTypeController.php index 5fd99ad0..ec450099 100644 --- a/app/Http/Controllers/V3/Azmayesh/AzmayeshTypeController.php +++ b/app/Http/Controllers/V3/Azmayesh/AzmayeshTypeController.php @@ -67,6 +67,8 @@ class AzmayeshTypeController extends Controller } $azmayeshType->azmayeshFields()->attach($fieldsID); + + auth()->user()->addActivityComplete(1162); }); return $this->successResponse(); @@ -100,6 +102,8 @@ class AzmayeshTypeController extends Controller } $azmayeshType->azmayeshFields()->sync($fieldsID); + + auth()->user()->addActivityComplete(1163); }); return $this->successResponse(); @@ -113,6 +117,8 @@ class AzmayeshTypeController extends Controller try { $azmayeshType->delete(); + auth()->user()->addActivityComplete(1164); + return $this->successResponse(); } catch (QueryException $exception) { diff --git a/app/Http/Controllers/V3/ProfileController.php b/app/Http/Controllers/V3/ProfileController.php index b5841811..930a2f0a 100644 --- a/app/Http/Controllers/V3/ProfileController.php +++ b/app/Http/Controllers/V3/ProfileController.php @@ -81,7 +81,7 @@ class ProfileController extends Controller public function addActivity(Request $request): JsonResponse { - auth()->user()->addActivityComplete($request->query('activityCode')); + auth()->user()->addActivityComplete($request->activityCode); return $this->successResponse(); } } diff --git a/app/Http/Controllers/V3/RoadPatrolProjectController.php b/app/Http/Controllers/V3/RoadPatrolProjectController.php index 0ef03630..a66cf00a 100644 --- a/app/Http/Controllers/V3/RoadPatrolProjectController.php +++ b/app/Http/Controllers/V3/RoadPatrolProjectController.php @@ -197,8 +197,8 @@ class RoadPatrolProjectController extends Controller 'description' => $request->description ?? null, ]); - $road_patrol->rahdaran()->attach($request->rahdaran_id); - $road_patrol->cmmsMachines()->attach($request->machines_id); + $road_patrol->rahdaran()->attach($request->road_patrol_rahdaran_id); + $road_patrol->cmmsMachines()->attach($request->road_patrol_machines_id); if ($request->observed_items) { foreach ($request->observed_items as $index => $item) { @@ -294,8 +294,8 @@ class RoadPatrolProjectController extends Controller ], 400); } - $road_item->rahdaran()->attach($request->rahdaran_id); - $road_item->cmmsMachines()->attach($request->machines_id); + $road_item->rahdaran()->attach($item['road_item_rahdaran_id']); + $road_item->cmmsMachines()->attach($item['road_item_machines_id']); } } } diff --git a/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php b/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php index fcdb3d2a..8a71cb1b 100644 --- a/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php +++ b/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php @@ -41,16 +41,21 @@ class StoreRequest extends FormRequest // road item projects fields 'observed_items.*.start_point' => 'required', 'observed_items.*.end_point' => '', - 'observed_items.*.amount' => 'numeric|required_if:instant_action,1', + 'observed_items.*.amount' => 'numeric|required_if:observed_items.*.instant_action,1', 'observed_items.*.before_image' => 'image|max:4096', 'observed_items.*.after_image' => 'image|max:4096', - 'observed_items.*.priority' => 'integer|in:1,2,3|required_if:instant_action,0', - 'observed_items.*.priority_fa' => 'string|required_if:instant_action,0', + 'observed_items.*.priority' => 'integer|in:1,2,3|required_if:observed_items.*.instant_action,0', + 'observed_items.*.priority_fa' => 'string|required_if:observed_items.*.instant_action,0', 'description' => 'string|required_with:observed_items', - 'machines_id' => 'required|array', - 'machines_id.*' => 'required|exists:cmms_machines,id', - 'rahdaran_id' => 'required|array', - 'rahdaran_id.*' => 'required|exists:rahdaran,id', + 'road_patrol_machines_id' => 'required|array', + 'road_patrol_machines_id.*' => 'required|exists:cmms_machines,id', + 'road_patrol_rahdaran_id' => 'required|array', + 'road_patrol_rahdaran_id.*' => 'required|exists:rahdaran,id', + + 'observed_items.*.road_item_machines_id' => 'required_if:observed_items.*.instant_action,1|array', + 'observed_items.*.road_item_machines_id.*' => 'required_if:observed_items.*.instant_action,1|exists:cmms_machines,id', + 'observed_items.*.road_item_rahdaran_id' => 'required_if:observed_items.*.instant_action,1|array', + 'observed_items.*.road_item_rahdaran_id.*' => 'required_if:observed_items.*.instant_action,1|exists:rahdaran,id', ]; } diff --git a/storage/sql-files/log_lists.sql b/storage/sql-files/log_lists.sql index 97afa167..914b9823 100644 --- a/storage/sql-files/log_lists.sql +++ b/storage/sql-files/log_lists.sql @@ -149,3 +149,15 @@ INSERT INTO log_lists (description,log_unique_code,action_type,is_done) VALUES ('ثبت فعالیت روزانه','1154','action',0), ('حذف نگهداری و حریم','1155','action',0), ('ورود به نقشه نگهداری حریم','1156','show',1); +INSERT INTO log_lists (description,log_unique_code,action_type,is_done) VALUES + ('ورود به کارتابل آزمایشات','1157','action',0), + ('ثبت آزمایش','1158','action',0), + ('ویرایش آزمایش','1159','action',0), + ('حذف آزمایش','1160','action',0), + ('ورود به کارتابل نوع آزمایشات','1161','action',0), + ('ثبت نوع آزمایش','1162','action',0), + ('ویرایش نوع آزمایش','1163','action',0), + ('حذف نوع آزمایش','1164','action',0), + ('ثبت نمونه آزمایش','1165','action',0), + ('ویرایش نمونه آزمایش','1166','action',0), + ('حذف نمونه آزمایش','1167','action',0), From 68109744f059a6a1dd1ec229e0947e96a7b4b532 Mon Sep 17 00:00:00 2001 From: amirghasempoor Date: Tue, 31 Dec 2024 16:40:21 +0330 Subject: [PATCH 2/7] add new columns to road patrol --- .../V3/RoadPatrolProjectController.php | 5 ++- .../V3/RoadPatrolProject/StoreRequest.php | 11 +++-- ...33123_add_column_to_road_patrols_table.php | 40 +++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 database/migrations/2024_12_31_133123_add_column_to_road_patrols_table.php diff --git a/app/Http/Controllers/V3/RoadPatrolProjectController.php b/app/Http/Controllers/V3/RoadPatrolProjectController.php index a66cf00a..4e2fbded 100644 --- a/app/Http/Controllers/V3/RoadPatrolProjectController.php +++ b/app/Http/Controllers/V3/RoadPatrolProjectController.php @@ -145,7 +145,7 @@ class RoadPatrolProjectController extends Controller return response()->json($data); } - public function store(StoreRequest $request, NominatimService $nominatimService) + public function store(StoreRequest $request, NominatimService $nominatimService): JsonResponse { $user = auth()->user(); @@ -195,6 +195,9 @@ class RoadPatrolProjectController extends Controller 'start_time' => $request->start_time, 'end_time' => $request->end_time, 'description' => $request->description ?? null, + 'fuel_consumption' => $request->fuel_consumption, + 'vehicle_runtime' => $request->vehicle_runtime, + 'stop_points' => json_encode($request->stop_points), ]); $road_patrol->rahdaran()->attach($request->road_patrol_rahdaran_id); diff --git a/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php b/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php index 8a71cb1b..353a814c 100644 --- a/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php +++ b/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php @@ -30,6 +30,13 @@ class StoreRequest extends FormRequest 'officer_phone_number' => 'required|digits:11', 'start_time' => 'required|date_format:Y-m-d H:i', 'end_time' => 'required|date_format:Y-m-d H:i|after:start_time', + 'fuel_consumption' => 'required|integer', + 'vehicle_runtime' => 'required|integer', + 'stop_points' => 'required|array', + 'road_patrol_machines_id' => 'required|array', + 'road_patrol_machines_id.*' => 'required|exists:cmms_machines,id', + 'road_patrol_rahdaran_id' => 'required|array', + 'road_patrol_rahdaran_id.*' => 'required|exists:rahdaran,id', 'observed_items' => 'array', 'observed_items.*.item_id' => 'required|integer', @@ -47,10 +54,6 @@ class StoreRequest extends FormRequest 'observed_items.*.priority' => 'integer|in:1,2,3|required_if:observed_items.*.instant_action,0', 'observed_items.*.priority_fa' => 'string|required_if:observed_items.*.instant_action,0', 'description' => 'string|required_with:observed_items', - 'road_patrol_machines_id' => 'required|array', - 'road_patrol_machines_id.*' => 'required|exists:cmms_machines,id', - 'road_patrol_rahdaran_id' => 'required|array', - 'road_patrol_rahdaran_id.*' => 'required|exists:rahdaran,id', 'observed_items.*.road_item_machines_id' => 'required_if:observed_items.*.instant_action,1|array', 'observed_items.*.road_item_machines_id.*' => 'required_if:observed_items.*.instant_action,1|exists:cmms_machines,id', diff --git a/database/migrations/2024_12_31_133123_add_column_to_road_patrols_table.php b/database/migrations/2024_12_31_133123_add_column_to_road_patrols_table.php new file mode 100644 index 00000000..47cbc9dd --- /dev/null +++ b/database/migrations/2024_12_31_133123_add_column_to_road_patrols_table.php @@ -0,0 +1,40 @@ +decimal('start_lat', 12, 10)->nullable()->change(); + $table->decimal('start_lng', 12, 10)->nullable()->change(); + $table->decimal('end_lat', 12, 10)->nullable()->change(); + $table->decimal('end_lng', 12, 10)->nullable()->change(); + $table->integer('fuel_consumption')->nullable(); + $table->integer('vehicle_runtime')->nullable(); + $table->json('stop_points')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('road_patrols', function (Blueprint $table) { + $table->decimal('start_lat', 12, 10)->change(); + $table->decimal('start_lng', 12, 10)->change(); + $table->decimal('end_lat', 12, 10)->change(); + $table->decimal('end_lng', 12, 10)->change(); + $table->dropColumn('fuel_consumption'); + $table->dropColumn('vehicle_runtime'); + $table->dropColumn('stop_points'); + }); + } +}; From 7a761b4fb5b53e8faff21a185beeb8ea82af6a24 Mon Sep 17 00:00:00 2001 From: amirghasempoor Date: Wed, 1 Jan 2025 16:42:20 +0330 Subject: [PATCH 3/7] fix the migration type --- ...1_133123_add_column_to_road_patrols_table.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/database/migrations/2024_12_31_133123_add_column_to_road_patrols_table.php b/database/migrations/2024_12_31_133123_add_column_to_road_patrols_table.php index 47cbc9dd..9dcd85bc 100644 --- a/database/migrations/2024_12_31_133123_add_column_to_road_patrols_table.php +++ b/database/migrations/2024_12_31_133123_add_column_to_road_patrols_table.php @@ -12,10 +12,10 @@ return new class extends Migration public function up(): void { Schema::table('road_patrols', function (Blueprint $table) { - $table->decimal('start_lat', 12, 10)->nullable()->change(); - $table->decimal('start_lng', 12, 10)->nullable()->change(); - $table->decimal('end_lat', 12, 10)->nullable()->change(); - $table->decimal('end_lng', 12, 10)->nullable()->change(); + $table->double('start_lat', null, 0)->nullable()->change(); + $table->double('start_lon', null, 0)->nullable()->change(); + $table->double('end_lat', null, 0)->nullable()->change(); + $table->double('end_lon', null, 0)->nullable()->change(); $table->integer('fuel_consumption')->nullable(); $table->integer('vehicle_runtime')->nullable(); $table->json('stop_points')->nullable(); @@ -28,10 +28,10 @@ return new class extends Migration public function down(): void { Schema::table('road_patrols', function (Blueprint $table) { - $table->decimal('start_lat', 12, 10)->change(); - $table->decimal('start_lng', 12, 10)->change(); - $table->decimal('end_lat', 12, 10)->change(); - $table->decimal('end_lng', 12, 10)->change(); + $table->double('start_lat', null, 0)->change(); + $table->double('start_lon', null, 0)->change(); + $table->double('end_lat', null, 0)->change(); + $table->double('end_lon', null, 0)->change(); $table->dropColumn('fuel_consumption'); $table->dropColumn('vehicle_runtime'); $table->dropColumn('stop_points'); From 294f89b4adc72063306c3f77cc9a931f57eba2b6 Mon Sep 17 00:00:00 2001 From: amirghasempoor Date: Sat, 4 Jan 2025 13:14:14 +0330 Subject: [PATCH 4/7] create a rule to verify otp --- .../V3/FMSVehicleManagementController.php | 1 - .../V3/RoadPatrolProjectController.php | 15 +---------- .../V3/RoadPatrolProject/StoreRequest.php | 7 ++--- app/Rules/VerificationCode.php | 27 +++++++++++++++++++ .../FMS/GetVehicleActivityService.php | 1 + 5 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 app/Rules/VerificationCode.php diff --git a/app/Http/Controllers/V3/FMSVehicleManagementController.php b/app/Http/Controllers/V3/FMSVehicleManagementController.php index f50221a7..898ede9d 100644 --- a/app/Http/Controllers/V3/FMSVehicleManagementController.php +++ b/app/Http/Controllers/V3/FMSVehicleManagementController.php @@ -22,7 +22,6 @@ class FMSVehicleManagementController extends Controller "machineCode" => $request->machineCode, "startDT" => $request->startDT, "endDT" => $request->endDT, - "minStopDuration" => $request->minStopDuration ]); $data = $getVehicleActivityService->run(); diff --git a/app/Http/Controllers/V3/RoadPatrolProjectController.php b/app/Http/Controllers/V3/RoadPatrolProjectController.php index 4e2fbded..27f84c65 100644 --- a/app/Http/Controllers/V3/RoadPatrolProjectController.php +++ b/app/Http/Controllers/V3/RoadPatrolProjectController.php @@ -161,24 +161,13 @@ class RoadPatrolProjectController extends Controller ], 400); } - $start_coordinates = explode(',', $request->start_point); - $end_coordinates = explode(',', $request->end_point); - $edare_id = $user->edarate_shahri_id ?? $user->edarate_ostani_id; $edare_name = $user->edarate_shahri_id ? $user->edarate_shahri_name : $user->edarate_ostani_name; - $road_patrol = DB::transaction(function () use ($request, $start_coordinates, - $end_coordinates, $edare_id, + $road_patrol = DB::transaction(function () use ($request, $edare_id, $edare_name, $nominatimService, $user) { $road_patrol = RoadPatrol::query()->create([ - 'start_lat' => $start_coordinates[0], - 'start_lon' => $start_coordinates[1], - 'end_lat' => $end_coordinates[0], - 'end_lon' => $end_coordinates[1], - 'officer_name' => $request->officer_name, - 'officer_phone_number' => $request->officer_phone_number, - 'officer_plaque' => $request->officer_plaque, 'operator_id' => $user->id, 'operator_name' => $user->name, 'province_id' => $user->province_id, @@ -187,8 +176,6 @@ class RoadPatrolProjectController extends Controller 'city_fa' => $user->city_fa, 'edare_id' => $edare_id, 'edare_name' => $edare_name, - 'start_way_id' => $nominatimService->get_way_id_from_nominatim($start_coordinates[0], $start_coordinates[1]), - 'end_way_id' => $nominatimService->get_way_id_from_nominatim($end_coordinates[0], $end_coordinates[1]), 'status' => 0, 'status_fa' => 'در حال بررسی', 'distance' => $request->distance, diff --git a/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php b/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php index 353a814c..b0986e4b 100644 --- a/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php +++ b/app/Http/Requests/V3/RoadPatrolProject/StoreRequest.php @@ -2,6 +2,7 @@ namespace App\Http\Requests\V3\RoadPatrolProject; +use App\Rules\VerificationCode; use Illuminate\Foundation\Http\FormRequest; class StoreRequest extends FormRequest @@ -22,12 +23,8 @@ class StoreRequest extends FormRequest public function rules(): array { return [ - 'start_point' => 'required', - 'end_point' => 'required', + 'verification_code' => ['required', 'string', new VerificationCode($this->phone_number)], 'distance' => 'numeric', - 'officer_name' => 'required', - 'officer_plaque' => 'required', - 'officer_phone_number' => 'required|digits:11', 'start_time' => 'required|date_format:Y-m-d H:i', 'end_time' => 'required|date_format:Y-m-d H:i|after:start_time', 'fuel_consumption' => 'required|integer', diff --git a/app/Rules/VerificationCode.php b/app/Rules/VerificationCode.php new file mode 100644 index 00000000..fedeb0c5 --- /dev/null +++ b/app/Rules/VerificationCode.php @@ -0,0 +1,27 @@ +phone_number, $value); + + if (!$verified) { + $fail('The :attribute is not valid.')->translate(); + } + } +} diff --git a/app/Services/FMS/GetVehicleActivityService.php b/app/Services/FMS/GetVehicleActivityService.php index 94f124eb..e7b6dd28 100644 --- a/app/Services/FMS/GetVehicleActivityService.php +++ b/app/Services/FMS/GetVehicleActivityService.php @@ -63,6 +63,7 @@ class GetVehicleActivityService $inputData = $this->inputParameters + array( "username" => $this->username, "password" => $this->password, + "minStopDuration" => 1, ); return json_encode($inputData); From 311f03921c87d10004b42e63f45212bb6106b70e Mon Sep 17 00:00:00 2001 From: amirghasempoor Date: Sat, 4 Jan 2025 14:57:43 +0330 Subject: [PATCH 5/7] create datatable for observed item --- .../Controllers/V3/ObservedItemController.php | 60 +++++++++++++++++++ .../V3/ObservedItem/FilterRequest.php | 39 ++++++++++++ routes/v3.php | 10 +++- 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 app/Http/Controllers/V3/ObservedItemController.php create mode 100644 app/Http/Requests/V3/ObservedItem/FilterRequest.php diff --git a/app/Http/Controllers/V3/ObservedItemController.php b/app/Http/Controllers/V3/ObservedItemController.php new file mode 100644 index 00000000..64a2167e --- /dev/null +++ b/app/Http/Controllers/V3/ObservedItemController.php @@ -0,0 +1,60 @@ +successResponse($observed_item); + } + + public function searchByFilter(FilterRequest $request): JsonResponse + { + $columns = array( + 'id', 'item_id', 'sub_item_id' + ); + + $allowedFilters = $columns; + $allowedSortings = $columns; + + $data = ObservedItem::query()->whereNull('road_item_id') + ->when($request->start_date, function (Builder $query) use ($request) { + return $query->whereHas('roadPatrol', function (Builder $query) use ($request) { + $query->WhereBetween('start_time', [$request->start_date.' 00:00:00', $request->end_date.' 23:59:59']) + ->orWhereBetween('end_time', [$request->start_date.' 00:00:00', $request->end_date.' 23:59:59']); + }); + }) + ->when($request->road_patrol_id, function (Builder $query) use ($request) { + return $query->where('road_patrol_id', $request->road_patrol_id); + }) + ->when($request->item_id, function (Builder $query) use ($request) { + return $query->where('item_id', $request->item_id); + }) + ->selectRaw('id as item, item_id, item_name, sub_item_id, sub_item_name, local_name'); + + if($data->get()->isEmpty()) { + return $this->errorResponse('موردی یافت نشد'); + } + + $dataTable = DataTableFacade::run( + $data, + $request, + allowedFilters: $allowedFilters, + allowedSortings: $allowedSortings); + + + return response()->json($dataTable); + } +} diff --git a/app/Http/Requests/V3/ObservedItem/FilterRequest.php b/app/Http/Requests/V3/ObservedItem/FilterRequest.php new file mode 100644 index 00000000..5c67f2c3 --- /dev/null +++ b/app/Http/Requests/V3/ObservedItem/FilterRequest.php @@ -0,0 +1,39 @@ +|string> + */ + public function rules(): array + { + return [ + 'start_date' => 'date_format:Y-m-d', + 'end_date' => 'date_format:Y-m-d|after_or_equal:start_date', + 'road_patrol_id' => 'numeric', + 'item_id' => 'numeric', + ]; + } + + public function attributes(): array + { + return [ + 'start_date' => 'ساعت شروع گشت', + 'end_date' => 'ساعت پایان گشت', + ]; + } +} diff --git a/routes/v3.php b/routes/v3.php index cab2d0a7..dda1d4e8 100644 --- a/routes/v3.php +++ b/routes/v3.php @@ -7,6 +7,7 @@ use App\Http\Controllers\V3\Azmayesh\AzmayeshTypeController; use App\Http\Controllers\V3\CMMSMachinesController; use App\Http\Controllers\V3\FMSVehicleManagementController; use App\Http\Controllers\V3\Harim\DivarkeshiController; +use App\Http\Controllers\V3\ObservedItemController; use App\Http\Controllers\V3\ProfileController; use App\Http\Controllers\V3\RahdaranController; use App\Http\Controllers\V3\RoadItemsProjectController; @@ -176,5 +177,12 @@ Route::prefix('fms_vehicle') ->name('fmsVehicle.') ->controller(FMSVehicleManagementController::class) ->group(function () { - Route::get('/get_activity', 'getActivity')->name('getActivity'); + Route::post('/get_activity', 'getActivity')->name('getActivity'); + }); + +Route::prefix('obseved_item') + ->name('observedItem.') + ->controller(ObservedItemController::class) + ->group(function () { + Route::post('/filter', 'filter')->name('filter'); }); From e95e4ca8cea328019fd45aff86b6c8f51824d08a Mon Sep 17 00:00:00 2001 From: amirghasempoor Date: Sat, 4 Jan 2025 15:02:09 +0330 Subject: [PATCH 6/7] fix the name route --- routes/v3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/v3.php b/routes/v3.php index dda1d4e8..ee190848 100644 --- a/routes/v3.php +++ b/routes/v3.php @@ -180,7 +180,7 @@ Route::prefix('fms_vehicle') Route::post('/get_activity', 'getActivity')->name('getActivity'); }); -Route::prefix('obseved_item') +Route::prefix('observed_items') ->name('observedItem.') ->controller(ObservedItemController::class) ->group(function () { From 57bb53475c58bc95806d1e831560d6ef06b7eee9 Mon Sep 17 00:00:00 2001 From: amirghasempoor Date: Sat, 4 Jan 2025 15:24:51 +0330 Subject: [PATCH 7/7] add detail api --- app/Http/Controllers/V3/ObservedItemController.php | 6 +++--- routes/v3.php | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/V3/ObservedItemController.php b/app/Http/Controllers/V3/ObservedItemController.php index 64a2167e..39169d72 100644 --- a/app/Http/Controllers/V3/ObservedItemController.php +++ b/app/Http/Controllers/V3/ObservedItemController.php @@ -15,12 +15,12 @@ use Illuminate\Support\Facades\Validator; class ObservedItemController extends Controller { use ApiResponse; - public function details(ObservedItem $observed_item): JsonResponse + public function show(ObservedItem $observedItem): JsonResponse { - return $this->successResponse($observed_item); + return $this->successResponse($observedItem); } - public function searchByFilter(FilterRequest $request): JsonResponse + public function filter(FilterRequest $request): JsonResponse { $columns = array( 'id', 'item_id', 'sub_item_id' diff --git a/routes/v3.php b/routes/v3.php index ee190848..6a71fb03 100644 --- a/routes/v3.php +++ b/routes/v3.php @@ -185,4 +185,5 @@ Route::prefix('observed_items') ->controller(ObservedItemController::class) ->group(function () { Route::post('/filter', 'filter')->name('filter'); + Route::get('/{observedItem}', 'show')->name('show'); });