From ae3a2b8ce07ac57c8badfe295ba86af36fbb32c9 Mon Sep 17 00:00:00 2001 From: amirghasempoor Date: Sat, 18 Oct 2025 09:20:24 +0330 Subject: [PATCH] add data input to request --- .../Commands/RoadObservationProblems.php | 3 +- app/Console/Kernel.php | 4 +-- .../Harim/PanjareVahedController.php | 3 +- .../Harim/PanjareVahed/ReceiveNewRequest.php | 1 + ...0_15_085149_add_column_to_harims_table.php | 29 +++++++++++++++++++ routes/v3.php | 2 +- 6 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 database/migrations/2025_10_15_085149_add_column_to_harims_table.php diff --git a/app/Console/Commands/RoadObservationProblems.php b/app/Console/Commands/RoadObservationProblems.php index b585d167..e25b3109 100755 --- a/app/Console/Commands/RoadObservationProblems.php +++ b/app/Console/Commands/RoadObservationProblems.php @@ -78,7 +78,8 @@ class RoadObservationProblems extends Command $mobile = $value->MobileForSendEventSms; } - $cityModel = City::findCityWithLatLng($value->XGeo, $value->YGeo); + $city = findCityFromGeoJson($value->YGeo, $value->XGeo); + $cityModel = $city ? City::query()->find($city['city_id']) : City::query()->find(NikarayanComplaints::mapCities((int) $value->fk_Town)); $rop = RoadObserved::query()->updateOrCreate( ['fk_RegisteredEventMessage' => $value->fk_RegisteredEventMessage], [ diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 72869440..281693b9 100755 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -41,8 +41,8 @@ class Kernel extends ConsoleKernel $schedule->command("webservice:roadobserved --daily-mode") ->dailyAt('00:45')->appendOutputTo(storage_path('logs/nikarayan.log')); - $schedule->command("db:backup") - ->weekly()->at('03:00')->appendOutputTo(storage_path('logs/mariadb-backup.log')); +// $schedule->command("db:backup") +// ->weekly()->at('03:00')->appendOutputTo(storage_path('logs/mariadb-backup.log')); $schedule->command('telescope:prune --hours=48') ->dailyAt('04:00') diff --git a/app/Http/Controllers/V3/Dashboard/Harim/PanjareVahedController.php b/app/Http/Controllers/V3/Dashboard/Harim/PanjareVahedController.php index 4c91eda7..8f9a6c43 100644 --- a/app/Http/Controllers/V3/Dashboard/Harim/PanjareVahedController.php +++ b/app/Http/Controllers/V3/Dashboard/Harim/PanjareVahedController.php @@ -62,6 +62,8 @@ class PanjareVahedController extends Controller 'response_options' => json_encode($request->response_options), 'isic' => $request->isic, 'primary_area' => json_encode($request->primary_area), + 'data' => $request->data['data'], + 'token' => $request->data['token'], ]); return $this->successResponse([ @@ -85,7 +87,6 @@ class PanjareVahedController extends Controller return $this->successResponse(); } - public function getRejectRequest(GetRejectRequest $request) { $state = HarimStates::MOKHALEFAT_BA_DASTGAH->value; diff --git a/app/Http/Requests/V3/Dashboard/Harim/PanjareVahed/ReceiveNewRequest.php b/app/Http/Requests/V3/Dashboard/Harim/PanjareVahed/ReceiveNewRequest.php index d2013ad4..f74449b8 100644 --- a/app/Http/Requests/V3/Dashboard/Harim/PanjareVahed/ReceiveNewRequest.php +++ b/app/Http/Requests/V3/Dashboard/Harim/PanjareVahed/ReceiveNewRequest.php @@ -36,6 +36,7 @@ class ReceiveNewRequest extends FormRequest 'primary_area' => 'required|array', 'primary_area.type' => 'required|string', 'primary_area.coordinates' => 'required|array', + 'data' => 'required|array', ]; } } diff --git a/database/migrations/2025_10_15_085149_add_column_to_harims_table.php b/database/migrations/2025_10_15_085149_add_column_to_harims_table.php new file mode 100644 index 00000000..06bbcf76 --- /dev/null +++ b/database/migrations/2025_10_15_085149_add_column_to_harims_table.php @@ -0,0 +1,29 @@ +longText('data')->nullable(); + $table->string('token', 255); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('harims', function (Blueprint $table) { + $table->dropColumn(['data', 'token']); + }); + } +}; diff --git a/routes/v3.php b/routes/v3.php index 338a4cc4..77c84bb2 100644 --- a/routes/v3.php +++ b/routes/v3.php @@ -386,7 +386,7 @@ Route::prefix('safety_and_privacy') Route::get('/map', 'map')->name('map'); Route::post('operator/second_step_store/{safetyAndPrivacy}', 'secondStepStore')->name('secondStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy','check-axis-type']); Route::post('operator/third_step_store/{safetyAndPrivacy}', 'thirdStepStore')->name('thirdStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy','check-axis-type']); - Route::post('operator/{safetyAndPrivacy}', 'update')->name('update')->middleware('permission:update-safety-and-privacy'); + Route::post('operator/{safetyAndPrivacy}', 'update')->name('update'); Route::get('operator/{safetyAndPrivacy}', 'show')->name('show'); Route::delete('operator/{safetyAndPrivacy}', 'destroy')->name('destroy')->middleware('permission:delete-safety-and-privacy'); Route::get('/deserialize/{safetyAndPrivacy}', 'deserialize')->name('deserialize');