From 70b4472f184dcf0a884be9512758f802b27af523 Mon Sep 17 00:00:00 2001 From: joddyabott Date: Wed, 3 Sep 2025 10:18:53 +0330 Subject: [PATCH] add one culum for rahdaran and add in controller --- .../Controllers/V3/RahdaranController.php | 2 ++ .../Requests/V3/Rahdaran/StoreRequest.php | 1 + .../Requests/V3/Rahdaran/UpdateRequest.php | 1 + ..._03_095512_add_phone_to_rahdaran_table.php | 29 +++++++++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 database/migrations/2025_09_03_095512_add_phone_to_rahdaran_table.php diff --git a/app/Http/Controllers/V3/RahdaranController.php b/app/Http/Controllers/V3/RahdaranController.php index e287ff84..a8368de7 100644 --- a/app/Http/Controllers/V3/RahdaranController.php +++ b/app/Http/Controllers/V3/RahdaranController.php @@ -30,6 +30,7 @@ class RahdaranController extends Controller Rahdaran::query()->create([ 'name' =>$request->name, 'code' =>$request->code, + 'mobile' =>$request->mobile, ]); return $this->successResponse(); } @@ -44,6 +45,7 @@ class RahdaranController extends Controller $rahdaran->update([ 'name' =>$request->name, 'code' =>$request->code, + 'mobile' =>$request->mobile, ]); return $this->successResponse(); } diff --git a/app/Http/Requests/V3/Rahdaran/StoreRequest.php b/app/Http/Requests/V3/Rahdaran/StoreRequest.php index e9436240..52613094 100644 --- a/app/Http/Requests/V3/Rahdaran/StoreRequest.php +++ b/app/Http/Requests/V3/Rahdaran/StoreRequest.php @@ -25,6 +25,7 @@ class StoreRequest extends FormRequest return [ 'name' => 'required|string|max:255', 'code' => 'required|string|max:255', + 'mobile' => 'required|digits:11|regex:/^09\d{9}$/', ]; } } diff --git a/app/Http/Requests/V3/Rahdaran/UpdateRequest.php b/app/Http/Requests/V3/Rahdaran/UpdateRequest.php index 9a8bc794..c9c87975 100644 --- a/app/Http/Requests/V3/Rahdaran/UpdateRequest.php +++ b/app/Http/Requests/V3/Rahdaran/UpdateRequest.php @@ -25,6 +25,7 @@ class UpdateRequest extends FormRequest return [ 'name' => 'required|string|max:255', 'code' => 'required|string|max:255', + 'mobile' => 'required|digits:11|regex:/^09\d{9}$/', ]; } } diff --git a/database/migrations/2025_09_03_095512_add_phone_to_rahdaran_table.php b/database/migrations/2025_09_03_095512_add_phone_to_rahdaran_table.php new file mode 100644 index 00000000..82a96ff1 --- /dev/null +++ b/database/migrations/2025_09_03_095512_add_phone_to_rahdaran_table.php @@ -0,0 +1,29 @@ +char('mobile', 11)->nullable(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('rahdaran', function (Blueprint $table) { + $table->dropColumn('mobile'); + }); + } +};