From 1b5d339a53861339a9ae0e0812aa3daad49606ea Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Mon, 25 May 2026 15:00:44 +0330 Subject: [PATCH 1/3] fix login code in3 point --- backend/app/Admin/Controllers/AuthController.php | 16 +--------------- backend/app/Models/Expert.php | 8 +++++--- backend/config/auth.php | 1 + backend/routes/expert.php | 1 - 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/backend/app/Admin/Controllers/AuthController.php b/backend/app/Admin/Controllers/AuthController.php index 4ea69b0a..9bd88920 100755 --- a/backend/app/Admin/Controllers/AuthController.php +++ b/backend/app/Admin/Controllers/AuthController.php @@ -16,19 +16,6 @@ class AuthController extends Controller { use ApiResponse; - public function register(RegisterRequest $request): JsonResponse - { - Expert::query()->create([ - 'username' => $request->username, - 'email' => $request->email, - 'password' => Hash::make($request->password), - ]); - - $request->session()->regenerate(); - - return $this->successResponse(); - } - public function login(LoginRequest $request): JsonResponse { $credentials = ['password' => $request->password]; @@ -39,8 +26,7 @@ class AuthController extends Controller $credentials['username'] = $request->login; } - if (Auth::attempt($credentials)) - { + if (Auth::guard('expert')->attempt($credentials)) { $request->session()->regenerate(); return $this->successResponse(); diff --git a/backend/app/Models/Expert.php b/backend/app/Models/Expert.php index 8003184b..ca4912a5 100755 --- a/backend/app/Models/Expert.php +++ b/backend/app/Models/Expert.php @@ -5,17 +5,19 @@ namespace App\Models; use Database\Factories\ExpertFactory; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Notifications\Notifiable; +use Illuminate\Foundation\Auth\User as Authenticatable; use Spatie\Permission\Traits\HasRoles; /** * @method roles() * @method permissions() */ -class Expert extends Model +class Expert extends Authenticatable { /** @use HasFactory */ - use HasFactory; - use HasRoles; + + use Notifiable,HasFactory,HasRoles; protected $guarded = ['id']; protected string $guard_name = 'web'; diff --git a/backend/config/auth.php b/backend/config/auth.php index a968e457..63cce897 100755 --- a/backend/config/auth.php +++ b/backend/config/auth.php @@ -1,5 +1,6 @@ name('auth.') ->controller(AuthController::class) ->group(function () { - Route::post('register', 'register')->name('register'); Route::post('login', 'login')->name('login'); Route::post('logout', 'logout')->name('logout'); }); From 26a0f79a6dd8fb8a06b8ba5dc9e975a76b1941f8 Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Mon, 25 May 2026 16:12:14 +0330 Subject: [PATCH 2/3] fix enum for gateway managment --- backend/app/Enums/BusinessTypeEnum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/Enums/BusinessTypeEnum.php b/backend/app/Enums/BusinessTypeEnum.php index 232cc49f..5bef3f00 100644 --- a/backend/app/Enums/BusinessTypeEnum.php +++ b/backend/app/Enums/BusinessTypeEnum.php @@ -41,7 +41,7 @@ enum BusinessTypeEnum: int }; } - public function name($id): string + public static function name($id): string { $mapArray = [ 1 => 'medical', From 5040299efc74ccddb20c5d2b2c6ccb662688fa28 Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Mon, 25 May 2026 16:18:08 +0330 Subject: [PATCH 3/3] fix user resource and profil --- backend/app/User/Controllers/ProfileController.php | 2 +- backend/app/User/Resources/UserResource.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/app/User/Controllers/ProfileController.php b/backend/app/User/Controllers/ProfileController.php index f8fb83e2..3a055d91 100755 --- a/backend/app/User/Controllers/ProfileController.php +++ b/backend/app/User/Controllers/ProfileController.php @@ -46,7 +46,7 @@ class ProfileController extends Controller $user->update([ 'first_name' => $request->first_name, 'last_name' => $request->last_name, - 'national_id' => $request->national_id, + 'national_id' => $user->kyc_status == 0 ? $request->national_id : $user->national_id, 'address' => $request->address, 'postal_code' => $request->postal_code, 'phone_number' => $request->phone_number, diff --git a/backend/app/User/Resources/UserResource.php b/backend/app/User/Resources/UserResource.php index d5df7636..9f98d7f8 100755 --- a/backend/app/User/Resources/UserResource.php +++ b/backend/app/User/Resources/UserResource.php @@ -24,12 +24,13 @@ class UserResource extends JsonResource 'address' => $this->address, 'postal_code' => $this->postal_code, 'phone_number' => $this->phone_number, - 'province_id' => $this->provonce_id, + 'province_id' => $this->province_id, 'province_name' => $this->province_name, 'city_id' => $this->city_id, 'city_name' => $this->city_name, 'birth_date' => $this->birth_date, 'kyc_status' => $this->kyc_status, + 'authority_level' => $this->authority_level, ]; } }