From c994a3cbd07b11bf8592bd729fa11cc938a06cd8 Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Sat, 16 May 2026 16:11:57 +0330 Subject: [PATCH 1/2] create edit in profile controller foe expert and this dependency --- .../Admin/Controllers/ProfileController.php | 19 ++++++++++ .../Admin/Requests/Profile/EditRequest.php | 36 +++++++++++++++++++ backend/routes/expert.php | 11 ++++++ 3 files changed, 66 insertions(+) create mode 100644 backend/app/Admin/Requests/Profile/EditRequest.php diff --git a/backend/app/Admin/Controllers/ProfileController.php b/backend/app/Admin/Controllers/ProfileController.php index 5b825966..23a80f7e 100644 --- a/backend/app/Admin/Controllers/ProfileController.php +++ b/backend/app/Admin/Controllers/ProfileController.php @@ -3,6 +3,7 @@ namespace App\Admin\Controllers; use App\Admin\Requests\Profile\ChangePasswordRequest; +use App\Admin\Requests\Profile\EditRequest; use App\Admin\Resources\ExpertResource; use App\Http\Controllers\Controller; use App\Traits\ApiResponse; @@ -19,6 +20,24 @@ class ProfileController extends Controller return $this->successResponse(new ExpertResource(Auth::guard('expert')->user())); } + public function edit(EditRequest $request): JsonResponse + { + $expert = $request->user('expert'); + + $expert->update([ + 'username' => $request->username, + 'first_name' => $request->first_name, + 'last_name' => $request->last_name, + 'email' => $expert->email, + 'national_id' => $request->national_id, + 'phone_number' => $request->phone_number, + 'province_id' => $request->province_id, + 'city_id' => $request->city_id, + ]); + + return $this->successResponse(); + } + public function changePassword(ChangePasswordRequest $request): JsonResponse { $expert = Auth::guard('expert')->user(); diff --git a/backend/app/Admin/Requests/Profile/EditRequest.php b/backend/app/Admin/Requests/Profile/EditRequest.php new file mode 100644 index 00000000..dcdbeef1 --- /dev/null +++ b/backend/app/Admin/Requests/Profile/EditRequest.php @@ -0,0 +1,36 @@ + + */ + public function rules(): array + { + return [ + 'username' => 'string|max:255', + 'first_name' => 'string', + 'last_name' => 'string', + 'email' => 'string|email|max:255', + 'national_id' => 'string', + 'phone_number' => 'string', + 'province_id' => 'string', + 'city_id' => 'string', + ]; + } +} diff --git a/backend/routes/expert.php b/backend/routes/expert.php index db005e64..fcd1803d 100755 --- a/backend/routes/expert.php +++ b/backend/routes/expert.php @@ -2,6 +2,7 @@ use App\Admin\Controllers\AuthController; use App\Admin\Controllers\DocumentationController; +use App\Admin\Controllers\ProfileController; Route::prefix('auth') ->name('auth.') @@ -22,3 +23,13 @@ Route::prefix('documents') Route::post('reject', 'reject')->name('reject'); Route::get('files/{user}', 'files')->name('files'); }); + +Route::prefix('profile') + ->name('profile.') + ->middleware('auth') + ->controller(ProfileController::class) + ->group(function () { + Route::get('info', 'info')->name('info'); + Route::post('edit', 'edit')->name('edit'); + Route::post('change_password', 'changePassword')->name('changePassword'); + }); -- 2.49.1 From 81401060b070897df1d687827971c118ec65c217 Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Sun, 17 May 2026 14:48:07 +0330 Subject: [PATCH 2/2] fix confilict --- backend/app/Admin/Controllers/ProfileController.php | 1 + backend/routes/expert.php | 1 + 2 files changed, 2 insertions(+) diff --git a/backend/app/Admin/Controllers/ProfileController.php b/backend/app/Admin/Controllers/ProfileController.php index 23a80f7e..3a810e55 100644 --- a/backend/app/Admin/Controllers/ProfileController.php +++ b/backend/app/Admin/Controllers/ProfileController.php @@ -53,4 +53,5 @@ class ProfileController extends Controller return $this->successResponse(); } + } diff --git a/backend/routes/expert.php b/backend/routes/expert.php index fcd1803d..12c3e98a 100755 --- a/backend/routes/expert.php +++ b/backend/routes/expert.php @@ -33,3 +33,4 @@ Route::prefix('profile') Route::post('edit', 'edit')->name('edit'); Route::post('change_password', 'changePassword')->name('changePassword'); }); + -- 2.49.1