From b6e0191da7dbd831be73d516be3876f4b2fde84e Mon Sep 17 00:00:00 2001 From: joddyabott Date: Tue, 12 Aug 2025 17:16:31 +0330 Subject: [PATCH] create there culum for safty and privacy and use in controller --- .../SafetyAndPrivacy/OperatorController.php | 7 ++++- .../FirstStepStoreRequest.php | 1 + .../ThirdStepStoreRequest.php | 2 ++ app/Models/SafetyAndPrivacy.php | 5 +++- .../SafetyAndPrivacy/OperatorService.php | 3 +- ...d_pictures_to_safety_and_privacy_table.php | 30 +++++++++++++++++++ 6 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 database/migrations/2025_08_12_162810_add_pictures_to_safety_and_privacy_table.php diff --git a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorController.php b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorController.php index 995233c1..b1ecda3a 100644 --- a/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorController.php +++ b/app/Http/Controllers/V3/Dashboard/SafetyAndPrivacy/OperatorController.php @@ -87,6 +87,9 @@ class OperatorController extends Controller $safety_and_privacy->recognize_picture = $request->has('recognize_picture') ? FileFacade::save($request->recognize_picture, "safety_and_privacy/{$safety_and_privacy->id}") : null; + $safety_and_privacy->recognize_picture_2 = $request->has('recognize_picture_2') ? + FileFacade::save($request->recognize_picture_2, "safety_and_privacy/{$safety_and_privacy->id}") : + null; $safety_and_privacy->save(); $user->addActivityComplete(1134); @@ -142,7 +145,9 @@ class OperatorController extends Controller 'step_fa' => SafetyAndPrivacySteps::name($step), 'status' => $status_id, 'status_fa' => SafetyAndPrivacyStatus::name($status_id), - 'action_picture' => FileFacade::save($request->action_picture, "safety_and_privacy/{$safetyAndPrivacy->id}/action_picture"), + 'action_picture' => FileFacade::save($request->action_picture, "safety_and_privacy/{$safetyAndPrivacy->id}/action_picture"), + 'finish_picture' => FileFacade::save($request->finish_picture, "safety_and_privacy/{$safetyAndPrivacy->id}/finish_picture"), + 'evidence_picture' => FileFacade::save($request->evidence_picture, "safety_and_privacy/{$safetyAndPrivacy->id}/evidence_picture"), 'action_picture_document_upload_date' => now(), 'action_date' => $request->action_date, 'is_finished' => true, diff --git a/app/Http/Requests/V3/SafetyAndPrivacy/FirstStepStoreRequest.php b/app/Http/Requests/V3/SafetyAndPrivacy/FirstStepStoreRequest.php index b7b7cf82..b8019d9c 100644 --- a/app/Http/Requests/V3/SafetyAndPrivacy/FirstStepStoreRequest.php +++ b/app/Http/Requests/V3/SafetyAndPrivacy/FirstStepStoreRequest.php @@ -27,6 +27,7 @@ class FirstStepStoreRequest extends FormRequest 'activity_date' => 'required|date_format:Y-m-d', 'activity_time' => 'required|date_format:H:i', 'recognize_picture' => 'required|image', + 'recognize_picture_2' => 'required|image', 'axis_type_id' => 'required|integer|exists:axis_types,id', ]; } diff --git a/app/Http/Requests/V3/SafetyAndPrivacy/ThirdStepStoreRequest.php b/app/Http/Requests/V3/SafetyAndPrivacy/ThirdStepStoreRequest.php index 91879ed5..9cab2e23 100644 --- a/app/Http/Requests/V3/SafetyAndPrivacy/ThirdStepStoreRequest.php +++ b/app/Http/Requests/V3/SafetyAndPrivacy/ThirdStepStoreRequest.php @@ -23,6 +23,8 @@ class ThirdStepStoreRequest extends FormRequest { return [ 'action_picture' => 'required|image', + 'finish_picture' => 'required|image', + 'evidence_picture' => 'required|image', 'action_date' => 'required|date', ]; } diff --git a/app/Models/SafetyAndPrivacy.php b/app/Models/SafetyAndPrivacy.php index 0ae5ac91..c75eaefc 100644 --- a/app/Models/SafetyAndPrivacy.php +++ b/app/Models/SafetyAndPrivacy.php @@ -45,7 +45,10 @@ class SafetyAndPrivacy extends Model 'need_judiciary', 'operator_description', 'supervisor_name', - 'supervisor_id' + 'supervisor_id', + 'finish_picture', + 'evidence_picture', + 'recognize_picture_2', ]; public $table = "safety_and_privacy"; diff --git a/app/Services/Cartables/SafetyAndPrivacy/OperatorService.php b/app/Services/Cartables/SafetyAndPrivacy/OperatorService.php index c653bc3b..336590b0 100644 --- a/app/Services/Cartables/SafetyAndPrivacy/OperatorService.php +++ b/app/Services/Cartables/SafetyAndPrivacy/OperatorService.php @@ -17,7 +17,8 @@ class OperatorService $fields = [ 'id','lat','lon', 'recognize_picture','action_picture','created_at','step', 'final_description', 'info_fa', 'activity_date_time', 'action_picture_document_upload_date', 'judiciary_document_upload_date', - 'step_fa', 'axis_type_id', 'axis_type_name', 'action_date', 'is_finished', 'status_fa', 'supervisor_description', 'operator_description' + 'step_fa', 'axis_type_id', 'axis_type_name', 'action_date', 'is_finished', 'status_fa', 'supervisor_description', + 'operator_description', 'finish_picture', 'evidence_picture', 'recognize_picture_2' ]; throw_if(is_null($user->edarate_shahri_id), new ProhibitedAction('اداره ای برای شما در سامانه ثبت نشده است!')); diff --git a/database/migrations/2025_08_12_162810_add_pictures_to_safety_and_privacy_table.php b/database/migrations/2025_08_12_162810_add_pictures_to_safety_and_privacy_table.php new file mode 100644 index 00000000..cb327e1e --- /dev/null +++ b/database/migrations/2025_08_12_162810_add_pictures_to_safety_and_privacy_table.php @@ -0,0 +1,30 @@ +string('recognize_picture_2'); + $table->string('finish_picture'); + $table->string('evidence_picture'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('safety_and_privacy', function (Blueprint $table) { + $table->dropColumn(['recognize_picture_2', 'finish_picture', 'evidence_picture']); + }); + } +};