From 51aa3b157cf9e92328d6673872909f3afdc0f8e6 Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Wed, 29 Apr 2026 16:52:18 +0330 Subject: [PATCH 01/10] create loggin and register whit their form requst --- backend/app/Models/User.php | 1 + .../User/Controller/Auth/AuthController.php | 64 +++++++++++++++++++ .../app/User/Requests/Auth/LoginRequest.php | 30 +++++++++ .../User/Requests/Auth/ًRegisterRequest.php | 30 +++++++++ backend/routes/api.php | 11 ++++ 5 files changed, 136 insertions(+) create mode 100644 backend/app/User/Controller/Auth/AuthController.php create mode 100644 backend/app/User/Requests/Auth/LoginRequest.php create mode 100644 backend/app/User/Requests/Auth/ًRegisterRequest.php diff --git a/backend/app/Models/User.php b/backend/app/Models/User.php index f62f69bb..56fbb341 100644 --- a/backend/app/Models/User.php +++ b/backend/app/Models/User.php @@ -30,4 +30,5 @@ class User extends Authenticatable 'password' => 'hashed', ]; } + protected $guarded = ['id']; } diff --git a/backend/app/User/Controller/Auth/AuthController.php b/backend/app/User/Controller/Auth/AuthController.php new file mode 100644 index 00000000..806a637b --- /dev/null +++ b/backend/app/User/Controller/Auth/AuthController.php @@ -0,0 +1,64 @@ +create([ + 'name' => $request->name, + 'email' => $request->email, + 'password' => Hash::make($request->password), + ]); + + $token = $user->createToken('Register Token')->accessToken; + + return response()->json([ + 'success' => true, + 'token_type' => 'Bearer', + 'access_token' => $token, + 'user' => [ + 'id' => $user->id, + 'username' => $user->username, + ], + ], 201); + } + + public function login(loginRequest $request): JsonResponse + { + if ($request->filled('email')) { + $user = User::query() + ->where('name', $request->name)->first(); + } + elseif ($request->filled('username')) { + $user = User::query() + ->where('name', $request->name) + ->first(); + } + + if (!$user || !Hash::check($request->password, $user->password)) { + return response()->json([ + 'message' => 'Invalid credentials' + ], 401); + } + + $token = $user->createToken('Login Token')->accessToken; + + return response()->json([ + 'success' => true, + 'token' => $token, + 'user' => [ + 'id' => $user->id, + 'name' => $user->name, + ], + ]); + } +} diff --git a/backend/app/User/Requests/Auth/LoginRequest.php b/backend/app/User/Requests/Auth/LoginRequest.php new file mode 100644 index 00000000..0c727045 --- /dev/null +++ b/backend/app/User/Requests/Auth/LoginRequest.php @@ -0,0 +1,30 @@ + + */ + public function rules(): array + { + return [ + 'name' => 'required|exists:users,name', + 'email' => 'required|email|exists:users,email', + 'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:8', + ]; + } +} diff --git a/backend/app/User/Requests/Auth/ًRegisterRequest.php b/backend/app/User/Requests/Auth/ًRegisterRequest.php new file mode 100644 index 00000000..b549fc37 --- /dev/null +++ b/backend/app/User/Requests/Auth/ًRegisterRequest.php @@ -0,0 +1,30 @@ + + */ + public function rules(): array + { + return [ + 'name' => 'required_without:email|unique:users,name', + 'email' => 'required|email|unique:users,email', + 'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:8', + ]; + } +} diff --git a/backend/routes/api.php b/backend/routes/api.php index f35f6f84..608543fc 100644 --- a/backend/routes/api.php +++ b/backend/routes/api.php @@ -1,8 +1,19 @@ user(); })->middleware('auth:api'); + +Route::prefix('user')->group(function () { + Route::prefix('Auth') + ->namespace('Auth') + ->controller(AuthController::class) + ->group(function () { + Route::post('register', 'register')->name('register'); + Route::post('login', 'login')->name('login'); + }); +}); From 5b42e23afcb05b4be9519b6f0c778d573dee717e Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Sat, 2 May 2026 09:09:34 +0330 Subject: [PATCH 02/10] improve form requst --- backend/app/User/Requests/Auth/LoginRequest.php | 4 ++-- backend/app/User/Requests/Auth/ًRegisterRequest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/app/User/Requests/Auth/LoginRequest.php b/backend/app/User/Requests/Auth/LoginRequest.php index 0c727045..1b92f793 100644 --- a/backend/app/User/Requests/Auth/LoginRequest.php +++ b/backend/app/User/Requests/Auth/LoginRequest.php @@ -22,8 +22,8 @@ class LoginRequest extends FormRequest public function rules(): array { return [ - 'name' => 'required|exists:users,name', - 'email' => 'required|email|exists:users,email', + 'name' => 'required_without:email|exists:users,name', + 'email' => 'required_without:name|email|exists:users,email', 'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:8', ]; } diff --git a/backend/app/User/Requests/Auth/ًRegisterRequest.php b/backend/app/User/Requests/Auth/ًRegisterRequest.php index b549fc37..e26d14e1 100644 --- a/backend/app/User/Requests/Auth/ًRegisterRequest.php +++ b/backend/app/User/Requests/Auth/ًRegisterRequest.php @@ -23,7 +23,7 @@ class ًRegisterRequest extends FormRequest { return [ 'name' => 'required_without:email|unique:users,name', - 'email' => 'required|email|unique:users,email', + 'email' => 'required_without:name|email|unique:users,email', 'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:8', ]; } From e74619d0ab86ac0fa0356e0c3d8276f7aaee5c6e Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Sat, 2 May 2026 15:29:09 +0330 Subject: [PATCH 03/10] reviwe my form request in login --- backend/app/User/Requests/Auth/LoginRequest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/app/User/Requests/Auth/LoginRequest.php b/backend/app/User/Requests/Auth/LoginRequest.php index 1b92f793..d00d7154 100644 --- a/backend/app/User/Requests/Auth/LoginRequest.php +++ b/backend/app/User/Requests/Auth/LoginRequest.php @@ -22,9 +22,9 @@ class LoginRequest extends FormRequest public function rules(): array { return [ - 'name' => 'required_without:email|exists:users,name', - 'email' => 'required_without:name|email|exists:users,email', - 'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:8', + 'name' => 'required_without:email|string', + 'email' => 'required_without:name|email', + 'password' => 'required|string', ]; } } From f788f9a7eabccb90ae88b1b49c1545668083d092 Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Sat, 2 May 2026 17:07:40 +0330 Subject: [PATCH 04/10] improve code and fix their bugs --- backend/app/Traits/ApiResponse.php | 31 +++++++++++ .../User/Controller/Auth/AuthController.php | 52 ++++++++++--------- .../app/User/Requests/Auth/LoginRequest.php | 2 +- ...RegisterRequest.php => RegisterRequest.php} | 4 +- backend/routes/api.php | 3 +- 5 files changed, 63 insertions(+), 29 deletions(-) create mode 100644 backend/app/Traits/ApiResponse.php rename backend/app/User/Requests/Auth/{ًRegisterRequest.php => RegisterRequest.php} (84%) diff --git a/backend/app/Traits/ApiResponse.php b/backend/app/Traits/ApiResponse.php new file mode 100644 index 00000000..5c9997d8 --- /dev/null +++ b/backend/app/Traits/ApiResponse.php @@ -0,0 +1,31 @@ +json([ + 'data' => $data + ], $statusCode); + } + + $message = $message ?? __('messages.successful'); + + return response()->json([ + 'message' => $message + ], $statusCode); + } + + public function errorResponse(string $message, string $type = 'logical_exception', int $statusCode = 422): JsonResponse + { + return response()->json([ + 'type' => $type, + 'message' => $message + ], $statusCode); + } +} diff --git a/backend/app/User/Controller/Auth/AuthController.php b/backend/app/User/Controller/Auth/AuthController.php index 806a637b..49640cb4 100644 --- a/backend/app/User/Controller/Auth/AuthController.php +++ b/backend/app/User/Controller/Auth/AuthController.php @@ -4,61 +4,63 @@ namespace App\User\Controller\Auth; use App\Http\Controllers\Controller; use App\Models\User; +use App\Traits\ApiResponse; use App\User\Requests\Auth\LoginRequest; -use App\User\Requests\Auth\ًRegisterRequest; +use App\User\Requests\Auth\RegisterRequest; use Illuminate\Http\JsonResponse; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Hash; class AuthController extends Controller { - public function register(ًRegisterRequest $request): JsonResponse + use ApiResponse; + + public function register(RegisterRequest $request): JsonResponse { $user = User::query()->create([ - 'name' => $request->name, + 'username' => $request->username, 'email' => $request->email, 'password' => Hash::make($request->password), ]); $token = $user->createToken('Register Token')->accessToken; - return response()->json([ - 'success' => true, + return $this->successResponse([ 'token_type' => 'Bearer', 'access_token' => $token, - 'user' => [ - 'id' => $user->id, - 'username' => $user->username, - ], - ], 201); + ]); } - public function login(loginRequest $request): JsonResponse + public function login(LoginRequest $request): JsonResponse { + $user = null; + if ($request->filled('email')) { $user = User::query() - ->where('name', $request->name)->first(); - } - elseif ($request->filled('username')) { + ->where('email', $request->email) + ->first(); + } elseif ($request->filled('username')) { $user = User::query() - ->where('name', $request->name) + ->where('username', $request->username) ->first(); } if (!$user || !Hash::check($request->password, $user->password)) { - return response()->json([ - 'message' => 'Invalid credentials' - ], 401); + return $this->errorResponse(''); } $token = $user->createToken('Login Token')->accessToken; - return response()->json([ - 'success' => true, - 'token' => $token, - 'user' => [ - 'id' => $user->id, - 'name' => $user->name, - ], + return $this->successResponse([ + 'token_type' => 'Bearer', + 'access_token' => $token, ]); } + + public function logout(Request $request): JsonResponse + { + $request->user()->token()->revoke(); + + return $this->successResponse(); + } } diff --git a/backend/app/User/Requests/Auth/LoginRequest.php b/backend/app/User/Requests/Auth/LoginRequest.php index d00d7154..18442f03 100644 --- a/backend/app/User/Requests/Auth/LoginRequest.php +++ b/backend/app/User/Requests/Auth/LoginRequest.php @@ -22,7 +22,7 @@ class LoginRequest extends FormRequest public function rules(): array { return [ - 'name' => 'required_without:email|string', + 'username' => 'required_without:email|string', 'email' => 'required_without:name|email', 'password' => 'required|string', ]; diff --git a/backend/app/User/Requests/Auth/ًRegisterRequest.php b/backend/app/User/Requests/Auth/RegisterRequest.php similarity index 84% rename from backend/app/User/Requests/Auth/ًRegisterRequest.php rename to backend/app/User/Requests/Auth/RegisterRequest.php index e26d14e1..54f8c783 100644 --- a/backend/app/User/Requests/Auth/ًRegisterRequest.php +++ b/backend/app/User/Requests/Auth/RegisterRequest.php @@ -4,7 +4,7 @@ namespace App\User\Requests\Auth; use Illuminate\Foundation\Http\FormRequest; -class ًRegisterRequest extends FormRequest +class RegisterRequest extends FormRequest { /** * Determine if the user is authorized to make this request. @@ -22,7 +22,7 @@ class ًRegisterRequest extends FormRequest public function rules(): array { return [ - 'name' => 'required_without:email|unique:users,name', + 'username' => 'required_without:email|unique:users,name', 'email' => 'required_without:name|email|unique:users,email', 'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:8', ]; diff --git a/backend/routes/api.php b/backend/routes/api.php index 608543fc..fa658a85 100644 --- a/backend/routes/api.php +++ b/backend/routes/api.php @@ -10,10 +10,11 @@ Route::get('/user', function (Request $request) { Route::prefix('user')->group(function () { Route::prefix('Auth') - ->namespace('Auth') + ->name('Auth') ->controller(AuthController::class) ->group(function () { Route::post('register', 'register')->name('register'); Route::post('login', 'login')->name('login'); + Route::post('logout', 'logout')->middleware('auth:api')->name('logout'); }); }); From 0bba710b7d2c27d1ebf9b675efeae48d39152c09 Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Sun, 3 May 2026 15:11:29 +0330 Subject: [PATCH 05/10] fix code --- backend/app/Providers/AppServiceProvider.php | 2 ++ backend/app/User/Controller/Auth/AuthController.php | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/app/Providers/AppServiceProvider.php b/backend/app/Providers/AppServiceProvider.php index bbedac67..616a7aea 100644 --- a/backend/app/Providers/AppServiceProvider.php +++ b/backend/app/Providers/AppServiceProvider.php @@ -4,6 +4,7 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; use Laravel\Passport\Passport; +use Carbon\CarbonInterval; class AppServiceProvider extends ServiceProvider { @@ -21,5 +22,6 @@ class AppServiceProvider extends ServiceProvider public function boot(): void { Passport::enablePasswordGrant(); + Passport::personalAccessTokensExpireIn(CarbonInterval::hour(2)); } } diff --git a/backend/app/User/Controller/Auth/AuthController.php b/backend/app/User/Controller/Auth/AuthController.php index 49640cb4..0d09f03f 100644 --- a/backend/app/User/Controller/Auth/AuthController.php +++ b/backend/app/User/Controller/Auth/AuthController.php @@ -9,6 +9,7 @@ use App\User\Requests\Auth\LoginRequest; use App\User\Requests\Auth\RegisterRequest; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; class AuthController extends Controller @@ -26,8 +27,7 @@ class AuthController extends Controller $token = $user->createToken('Register Token')->accessToken; return $this->successResponse([ - 'token_type' => 'Bearer', - 'access_token' => $token, + 'token' => $token, ]); } @@ -52,8 +52,7 @@ class AuthController extends Controller $token = $user->createToken('Login Token')->accessToken; return $this->successResponse([ - 'token_type' => 'Bearer', - 'access_token' => $token, + 'token' => $token, ]); } From 5024a242d290cd1f1b3d02e447eb931516694f65 Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Sun, 3 May 2026 15:28:50 +0330 Subject: [PATCH 06/10] fix code --- .../app/User/Controller/Auth/AuthController.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/backend/app/User/Controller/Auth/AuthController.php b/backend/app/User/Controller/Auth/AuthController.php index 0d09f03f..4dcabe15 100644 --- a/backend/app/User/Controller/Auth/AuthController.php +++ b/backend/app/User/Controller/Auth/AuthController.php @@ -33,17 +33,12 @@ class AuthController extends Controller public function login(LoginRequest $request): JsonResponse { - $user = null; + $uniq_identifier = $request->input('login'); + $user = User::query() + ->where('email', $uniq_identifier) + ->orWhere('username', $uniq_identifier) + ->first(); - if ($request->filled('email')) { - $user = User::query() - ->where('email', $request->email) - ->first(); - } elseif ($request->filled('username')) { - $user = User::query() - ->where('username', $request->username) - ->first(); - } if (!$user || !Hash::check($request->password, $user->password)) { return $this->errorResponse(''); From cee480fff5e9e02ff1a4cae2774feb34101062c8 Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Sun, 3 May 2026 15:29:57 +0330 Subject: [PATCH 07/10] improve the code in some part of the project --- backend/app/User/Controller/Auth/AuthController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/app/User/Controller/Auth/AuthController.php b/backend/app/User/Controller/Auth/AuthController.php index 4dcabe15..d6ca266d 100644 --- a/backend/app/User/Controller/Auth/AuthController.php +++ b/backend/app/User/Controller/Auth/AuthController.php @@ -9,7 +9,6 @@ use App\User\Requests\Auth\LoginRequest; use App\User\Requests\Auth\RegisterRequest; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; class AuthController extends Controller From b32ee444ca618307d63eb41e53b9f64f2d0ac06a Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Tue, 5 May 2026 17:33:34 +0330 Subject: [PATCH 08/10] write for user --- backend/app/Http/Resources/UserResource.php | 23 ++ backend/app/Models/User.php | 18 +- backend/app/Providers/AppServiceProvider.php | 2 +- backend/app/Traits/ApiResponse.php | 0 .../User/Controller/Auth/AuthController.php | 44 +-- .../app/User/Controller/ProfileController.php | 61 ++++ .../app/User/Requests/Auth/LoginRequest.php | 3 +- .../User/Requests/Auth/RegisterRequest.php | 6 +- .../Profile/ChangePasswordRequest.php | 30 ++ .../app/User/Requests/Profile/EditRequest.php | 37 +++ backend/bootstrap/app.php | 2 +- backend/config/auth.php | 0 backend/config/cors.php | 34 ++ backend/config/session.php | 0 backend/database/factories/UserFactory.php | 2 +- .../0001_01_01_000000_create_users_table.php | 24 +- backend/database/seeders/DatabaseSeeder.php | 3 +- backend/resources/lang/en/auth.php | 19 ++ backend/resources/lang/en/messages.php | 7 + backend/resources/lang/en/pagination.php | 19 ++ backend/resources/lang/en/passwords.php | 22 ++ backend/resources/lang/en/validation.php | 151 +++++++++ backend/resources/lang/fa.json | 137 ++++++++ backend/resources/lang/fa/auth.php | 19 ++ backend/resources/lang/fa/messages.php | 7 + backend/resources/lang/fa/pagination.php | 19 ++ backend/resources/lang/fa/passwords.php | 22 ++ backend/resources/lang/fa/validation.php | 292 ++++++++++++++++++ backend/routes/api.php | 10 - backend/routes/web.php | 21 +- 30 files changed, 969 insertions(+), 65 deletions(-) create mode 100755 backend/app/Http/Resources/UserResource.php mode change 100644 => 100755 backend/app/Models/User.php mode change 100644 => 100755 backend/app/Providers/AppServiceProvider.php mode change 100644 => 100755 backend/app/Traits/ApiResponse.php mode change 100644 => 100755 backend/app/User/Controller/Auth/AuthController.php create mode 100644 backend/app/User/Controller/ProfileController.php mode change 100644 => 100755 backend/app/User/Requests/Auth/LoginRequest.php mode change 100644 => 100755 backend/app/User/Requests/Auth/RegisterRequest.php create mode 100644 backend/app/User/Requests/Profile/ChangePasswordRequest.php create mode 100644 backend/app/User/Requests/Profile/EditRequest.php mode change 100644 => 100755 backend/bootstrap/app.php mode change 100644 => 100755 backend/config/auth.php create mode 100755 backend/config/cors.php mode change 100644 => 100755 backend/config/session.php mode change 100644 => 100755 backend/database/factories/UserFactory.php mode change 100644 => 100755 backend/database/migrations/0001_01_01_000000_create_users_table.php mode change 100644 => 100755 backend/database/seeders/DatabaseSeeder.php create mode 100644 backend/resources/lang/en/auth.php create mode 100644 backend/resources/lang/en/messages.php create mode 100644 backend/resources/lang/en/pagination.php create mode 100644 backend/resources/lang/en/passwords.php create mode 100644 backend/resources/lang/en/validation.php create mode 100644 backend/resources/lang/fa.json create mode 100644 backend/resources/lang/fa/auth.php create mode 100644 backend/resources/lang/fa/messages.php create mode 100644 backend/resources/lang/fa/pagination.php create mode 100644 backend/resources/lang/fa/passwords.php create mode 100644 backend/resources/lang/fa/validation.php mode change 100644 => 100755 backend/routes/api.php mode change 100644 => 100755 backend/routes/web.php diff --git a/backend/app/Http/Resources/UserResource.php b/backend/app/Http/Resources/UserResource.php new file mode 100755 index 00000000..30459058 --- /dev/null +++ b/backend/app/Http/Resources/UserResource.php @@ -0,0 +1,23 @@ + + */ + public function toArray(Request $request): array + { + return [ + 'id' => $this->id, + 'username' => $this->username, + 'email' => $this->email, + ]; + } +} diff --git a/backend/app/Models/User.php b/backend/app/Models/User.php old mode 100644 new mode 100755 index 56fbb341..9f73d3cc --- a/backend/app/Models/User.php +++ b/backend/app/Models/User.php @@ -5,30 +5,18 @@ namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; use Database\Factories\UserFactory; use Illuminate\Database\Eloquent\Attributes\Fillable; +use Illuminate\Database\Eloquent\Attributes\Guarded; use Illuminate\Database\Eloquent\Attributes\Hidden; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Passport\HasApiTokens; -#[Fillable(['name', 'email', 'password'])] -#[Hidden(['password', 'remember_token'])] +#[Guarded(['id'])] +#[Hidden(['password'])] class User extends Authenticatable { /** @use HasFactory */ use HasFactory, Notifiable, HasApiTokens; - - /** - * Get the attributes that should be cast. - * - * @return array - */ - protected function casts(): array - { - return [ - 'email_verified_at' => 'datetime', - 'password' => 'hashed', - ]; - } protected $guarded = ['id']; } diff --git a/backend/app/Providers/AppServiceProvider.php b/backend/app/Providers/AppServiceProvider.php old mode 100644 new mode 100755 index 616a7aea..1039668a --- a/backend/app/Providers/AppServiceProvider.php +++ b/backend/app/Providers/AppServiceProvider.php @@ -22,6 +22,6 @@ class AppServiceProvider extends ServiceProvider public function boot(): void { Passport::enablePasswordGrant(); - Passport::personalAccessTokensExpireIn(CarbonInterval::hour(2)); + Passport::personalAccessTokensExpireIn(CarbonInterval::minutes(1)); } } diff --git a/backend/app/Traits/ApiResponse.php b/backend/app/Traits/ApiResponse.php old mode 100644 new mode 100755 diff --git a/backend/app/User/Controller/Auth/AuthController.php b/backend/app/User/Controller/Auth/AuthController.php old mode 100644 new mode 100755 index d6ca266d..d8b59502 --- a/backend/app/User/Controller/Auth/AuthController.php +++ b/backend/app/User/Controller/Auth/AuthController.php @@ -3,12 +3,14 @@ namespace App\User\Controller\Auth; use App\Http\Controllers\Controller; +use App\Http\Resources\UserResource; use App\Models\User; use App\Traits\ApiResponse; use App\User\Requests\Auth\LoginRequest; use App\User\Requests\Auth\RegisterRequest; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; class AuthController extends Controller @@ -17,42 +19,48 @@ class AuthController extends Controller public function register(RegisterRequest $request): JsonResponse { - $user = User::query()->create([ + User::query()->create([ 'username' => $request->username, 'email' => $request->email, 'password' => Hash::make($request->password), ]); - $token = $user->createToken('Register Token')->accessToken; + $request->session()->regenerate(); - return $this->successResponse([ - 'token' => $token, - ]); + return $this->successResponse(); } public function login(LoginRequest $request): JsonResponse { - $uniq_identifier = $request->input('login'); - $user = User::query() - ->where('email', $uniq_identifier) - ->orWhere('username', $uniq_identifier) - ->first(); + $credentials = ['password' => $request->password,]; - - if (!$user || !Hash::check($request->password, $user->password)) { - return $this->errorResponse(''); + if (filter_var($request->login, FILTER_VALIDATE_EMAIL)) { + $credentials['email'] = $request->login; + } else { + $credentials['username'] = $request->login; } - $token = $user->createToken('Login Token')->accessToken; + if (Auth::attempt($credentials)) + { + $request->session()->regenerate(); - return $this->successResponse([ - 'token' => $token, - ]); + $user = Auth::user(); + + return $this->successResponse([ + 'info' => new UserResource($user), + ]); + } + + return $this->errorResponse(__('messages.incorrect_or_username_password')); } public function logout(Request $request): JsonResponse { - $request->user()->token()->revoke(); + Auth::logout(); + + $request->session()->invalidate(); + + $request->session()->regenerateToken(); return $this->successResponse(); } diff --git a/backend/app/User/Controller/ProfileController.php b/backend/app/User/Controller/ProfileController.php new file mode 100644 index 00000000..b3aa09ce --- /dev/null +++ b/backend/app/User/Controller/ProfileController.php @@ -0,0 +1,61 @@ +successResponse([ + 'info' => new UserResource($user), + ]); + } + + public function edit(EditRequest $request): JsonResponse + { + $user = Auth::user(); + + $user->update([ + 'first_name' => $request->first_name, + 'last_name' => $request->last_name, + 'national_id' => $request->national_id, + 'address' => $request->address, + 'postal_code' => $request->postal_code, + 'account_number' => $request->account_number, + 'phone_number' => $request->phone_number, + 'province_id' => $request->province_id, + 'city_id' => $request->city_id, + ]); + + return $this->successResponse(); + } + + public function changePassword(ChangePasswordRequest $request): JsonResponse + { + $user = Auth::user(); + + if (! Hash::check($request->current_password, $user->password)) { + return $this->errorResponse(__('messages.incorrect_current_password')); + } + + $user->update([ + 'password' => Hash::make($request->new_password), + ]); + + return $this->successResponse(); + + } +} diff --git a/backend/app/User/Requests/Auth/LoginRequest.php b/backend/app/User/Requests/Auth/LoginRequest.php old mode 100644 new mode 100755 index 18442f03..d9b9c881 --- a/backend/app/User/Requests/Auth/LoginRequest.php +++ b/backend/app/User/Requests/Auth/LoginRequest.php @@ -22,8 +22,7 @@ class LoginRequest extends FormRequest public function rules(): array { return [ - 'username' => 'required_without:email|string', - 'email' => 'required_without:name|email', + 'login' => 'required|string', 'password' => 'required|string', ]; } diff --git a/backend/app/User/Requests/Auth/RegisterRequest.php b/backend/app/User/Requests/Auth/RegisterRequest.php old mode 100644 new mode 100755 index 54f8c783..97667b23 --- a/backend/app/User/Requests/Auth/RegisterRequest.php +++ b/backend/app/User/Requests/Auth/RegisterRequest.php @@ -22,9 +22,9 @@ class RegisterRequest extends FormRequest public function rules(): array { return [ - 'username' => 'required_without:email|unique:users,name', - 'email' => 'required_without:name|email|unique:users,email', - 'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:8', + 'username' => 'required|unique:users,username', + 'email' => 'required|email|unique:users,email', + 'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:6', ]; } } diff --git a/backend/app/User/Requests/Profile/ChangePasswordRequest.php b/backend/app/User/Requests/Profile/ChangePasswordRequest.php new file mode 100644 index 00000000..60e53c56 --- /dev/null +++ b/backend/app/User/Requests/Profile/ChangePasswordRequest.php @@ -0,0 +1,30 @@ + + */ + public function rules(): array + { + return [ + 'current_password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:6', + 'new_password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:6', + ]; + } +} diff --git a/backend/app/User/Requests/Profile/EditRequest.php b/backend/app/User/Requests/Profile/EditRequest.php new file mode 100644 index 00000000..ddcfcba8 --- /dev/null +++ b/backend/app/User/Requests/Profile/EditRequest.php @@ -0,0 +1,37 @@ + + */ + public function rules(): array + { + return [ + 'first_name' => 'required|string', + 'last_name' => 'required|string', + 'national_id' => 'required', + 'address' => 'required', + 'postal_code' => 'required', + 'account_number' => 'required', + 'phone_number' => 'required|regex:/^964\d{9}$/|numeric|digits:11', + 'province_id' => 'required', + 'city_id' => 'required', + ]; + } +} diff --git a/backend/bootstrap/app.php b/backend/bootstrap/app.php old mode 100644 new mode 100755 index c3928c57..6de85c67 --- a/backend/bootstrap/app.php +++ b/backend/bootstrap/app.php @@ -12,7 +12,7 @@ return Application::configure(basePath: dirname(__DIR__)) health: '/up', ) ->withMiddleware(function (Middleware $middleware): void { - // + $middleware->web()->validateCsrfTokens(['*']); }) ->withExceptions(function (Exceptions $exceptions): void { // diff --git a/backend/config/auth.php b/backend/config/auth.php old mode 100644 new mode 100755 diff --git a/backend/config/cors.php b/backend/config/cors.php new file mode 100755 index 00000000..a76728a2 --- /dev/null +++ b/backend/config/cors.php @@ -0,0 +1,34 @@ + ['*'], + + 'allowed_methods' => ['*'], + + 'allowed_origins' => ['*'], + + 'allowed_origins_patterns' => [], + + 'allowed_headers' => ['*'], + + 'exposed_headers' => [], + + 'max_age' => 0, + + 'supports_credentials' => true, + +]; diff --git a/backend/config/session.php b/backend/config/session.php old mode 100644 new mode 100755 diff --git a/backend/database/factories/UserFactory.php b/backend/database/factories/UserFactory.php old mode 100644 new mode 100755 index c4ceb074..b3301b8b --- a/backend/database/factories/UserFactory.php +++ b/backend/database/factories/UserFactory.php @@ -25,7 +25,7 @@ class UserFactory extends Factory public function definition(): array { return [ - 'name' => fake()->name(), + 'username' => fake()->name(), 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), 'password' => static::$password ??= Hash::make('password'), diff --git a/backend/database/migrations/0001_01_01_000000_create_users_table.php b/backend/database/migrations/0001_01_01_000000_create_users_table.php old mode 100644 new mode 100755 index 05fb5d9e..87b84e12 --- a/backend/database/migrations/0001_01_01_000000_create_users_table.php +++ b/backend/database/migrations/0001_01_01_000000_create_users_table.php @@ -13,18 +13,23 @@ return new class extends Migration { Schema::create('users', function (Blueprint $table) { $table->id(); - $table->string('name'); + $table->string('username'); + $table->string('first_name')->nullable(); + $table->string('last_name')->nullable(); $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - }); + $table->tinyInteger('status')->default(0); + $table->string('national_id')->nullable(); + $table->string('address')->nullable(); + $table->string('postal_code')->nullable(); + $table->string('account_number')->nullable(); + $table->string('phone_number')->nullable(); + $table->string('province_id')->nullable(); + $table->string('province_name')->nullable(); + $table->string('city_id')->nullable(); + $table->string('city_name')->nullable(); - Schema::create('password_reset_tokens', function (Blueprint $table) { - $table->string('email')->primary(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); + $table->timestamps(); }); Schema::create('sessions', function (Blueprint $table) { @@ -43,7 +48,6 @@ return new class extends Migration public function down(): void { Schema::dropIfExists('users'); - Schema::dropIfExists('password_reset_tokens'); Schema::dropIfExists('sessions'); } }; diff --git a/backend/database/seeders/DatabaseSeeder.php b/backend/database/seeders/DatabaseSeeder.php old mode 100644 new mode 100755 index 6b901f8b..55af5ff8 --- a/backend/database/seeders/DatabaseSeeder.php +++ b/backend/database/seeders/DatabaseSeeder.php @@ -18,8 +18,9 @@ class DatabaseSeeder extends Seeder // User::factory(10)->create(); User::factory()->create([ - 'name' => 'Test User', + 'username' => 'Test User', 'email' => 'test@example.com', + 'password' => 'password123@', ]); } } diff --git a/backend/resources/lang/en/auth.php b/backend/resources/lang/en/auth.php new file mode 100644 index 00000000..e5506df2 --- /dev/null +++ b/backend/resources/lang/en/auth.php @@ -0,0 +1,19 @@ + 'These credentials do not match our records.', + 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', + +]; diff --git a/backend/resources/lang/en/messages.php b/backend/resources/lang/en/messages.php new file mode 100644 index 00000000..2d88fb58 --- /dev/null +++ b/backend/resources/lang/en/messages.php @@ -0,0 +1,7 @@ + 'The Operation was successful', + 'incorrect_current_password' => 'The current password is incorrect.', + 'incorrect_or_username_password' => 'The username or password is incorrect.', +]; diff --git a/backend/resources/lang/en/pagination.php b/backend/resources/lang/en/pagination.php new file mode 100644 index 00000000..d4814118 --- /dev/null +++ b/backend/resources/lang/en/pagination.php @@ -0,0 +1,19 @@ + '« Previous', + 'next' => 'Next »', + +]; diff --git a/backend/resources/lang/en/passwords.php b/backend/resources/lang/en/passwords.php new file mode 100644 index 00000000..724de4b9 --- /dev/null +++ b/backend/resources/lang/en/passwords.php @@ -0,0 +1,22 @@ + 'Your password has been reset!', + 'sent' => 'We have e-mailed your password reset link!', + 'throttled' => 'Please wait before retrying.', + 'token' => 'This password reset token is invalid.', + 'user' => "We can't find a user with that e-mail address.", + +]; diff --git a/backend/resources/lang/en/validation.php b/backend/resources/lang/en/validation.php new file mode 100644 index 00000000..a65914f9 --- /dev/null +++ b/backend/resources/lang/en/validation.php @@ -0,0 +1,151 @@ + 'The :attribute must be accepted.', + 'active_url' => 'The :attribute is not a valid URL.', + 'after' => 'The :attribute must be a date after :date.', + 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', + 'alpha' => 'The :attribute may only contain letters.', + 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', + 'alpha_num' => 'The :attribute may only contain letters and numbers.', + 'array' => 'The :attribute must be an array.', + 'before' => 'The :attribute must be a date before :date.', + 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', + 'between' => [ + 'numeric' => 'The :attribute must be between :min and :max.', + 'file' => 'The :attribute must be between :min and :max kilobytes.', + 'string' => 'The :attribute must be between :min and :max characters.', + 'array' => 'The :attribute must have between :min and :max items.', + ], + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_equals' => 'The :attribute must be a date equal to :date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', + 'digits_between' => 'The :attribute must be between :min and :max digits.', + 'dimensions' => 'The :attribute has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'email' => 'The :attribute must be a valid email address.', + 'ends_with' => 'The :attribute must end with one of the following: :values.', + 'exists' => 'The selected :attribute is invalid.', + 'file' => 'The :attribute must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'gt' => [ + 'numeric' => 'The :attribute must be greater than :value.', + 'file' => 'The :attribute must be greater than :value kilobytes.', + 'string' => 'The :attribute must be greater than :value characters.', + 'array' => 'The :attribute must have more than :value items.', + ], + 'gte' => [ + 'numeric' => 'The :attribute must be greater than or equal :value.', + 'file' => 'The :attribute must be greater than or equal :value kilobytes.', + 'string' => 'The :attribute must be greater than or equal :value characters.', + 'array' => 'The :attribute must have :value items or more.', + ], + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field does not exist in :other.', + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'ipv4' => 'The :attribute must be a valid IPv4 address.', + 'ipv6' => 'The :attribute must be a valid IPv6 address.', + 'json' => 'The :attribute must be a valid JSON string.', + 'lt' => [ + 'numeric' => 'The :attribute must be less than :value.', + 'file' => 'The :attribute must be less than :value kilobytes.', + 'string' => 'The :attribute must be less than :value characters.', + 'array' => 'The :attribute must have less than :value items.', + ], + 'lte' => [ + 'numeric' => 'The :attribute must be less than or equal :value.', + 'file' => 'The :attribute must be less than or equal :value kilobytes.', + 'string' => 'The :attribute must be less than or equal :value characters.', + 'array' => 'The :attribute must not have more than :value items.', + ], + 'max' => [ + 'numeric' => 'The :attribute may not be greater than :max.', + 'file' => 'The :attribute may not be greater than :max kilobytes.', + 'string' => 'The :attribute may not be greater than :max characters.', + 'array' => 'The :attribute may not have more than :max items.', + ], + 'mimes' => 'The :attribute must be a file of type: :values.', + 'mimetypes' => 'The :attribute must be a file of type: :values.', + 'min' => [ + 'numeric' => 'The :attribute must be at least :min.', + 'file' => 'The :attribute must be at least :min kilobytes.', + 'string' => 'The :attribute must be at least :min characters.', + 'array' => 'The :attribute must have at least :min items.', + ], + 'not_in' => 'The selected :attribute is invalid.', + 'not_regex' => 'The :attribute format is invalid.', + 'numeric' => 'The :attribute must be a number.', + 'password' => 'The password is incorrect.', + 'present' => 'The :attribute field must be present.', + 'regex' => 'The :attribute format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values are present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => 'The :attribute and :other must match.', + 'size' => [ + 'numeric' => 'The :attribute must be :size.', + 'file' => 'The :attribute must be :size kilobytes.', + 'string' => 'The :attribute must be :size characters.', + 'array' => 'The :attribute must contain :size items.', + ], + 'starts_with' => 'The :attribute must start with one of the following: :values.', + 'string' => 'The :attribute must be a string.', + 'timezone' => 'The :attribute must be a valid zone.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'url' => 'The :attribute format is invalid.', + 'uuid' => 'The :attribute must be a valid UUID.', + + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute.rule" to name the lines. This makes it quick to + | specify a specific custom language line for a given attribute rule. + | + */ + + 'custom' => [ + 'attribute-name' => [ + 'rule-name' => 'custom-message', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Custom Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap our attribute placeholder + | with something more reader friendly such as "E-Mail Address" instead + | of "email". This simply helps us make our message more expressive. + | + */ + + 'attributes' => [], + +]; diff --git a/backend/resources/lang/fa.json b/backend/resources/lang/fa.json new file mode 100644 index 00000000..85cf9f1d --- /dev/null +++ b/backend/resources/lang/fa.json @@ -0,0 +1,137 @@ +{ + "Reset Password Notification": "بازیابی رمز عبور", + "You are receiving this email because we received a password reset request for your account.": "شما این ایمیل را برای بازیابی رمز عبور از ما دریافت کرده اید.", + "Reset Password": "بازیابی رمز عبور", + "This password reset link will expire in :count minutes.": "این لینک بازیابی در :count دقیقه دیگر منقضی میشود.", + "If you did not request a password reset, no further action is required.": "اگر شما برای بازیابی رمز عبور درخواست نداده اید این ایمیل را نادیده بگیرید.", + "Verify Email Address": "تایید آدرس ایمیل", + "Please click the button below to verify your email address.": "برای تایید ایمیل لطفا بر ری دکمه زیر کلیک کنید", + "If you did not create an account, no further action is required.": "اگر شما برای تایید حساب درخواست نداده اید این ایمیل را نادیده بگیرید.", + "Login": "ورود", + "E-Mail Address": "ادرس ایمیل", + "Password": "رمز عبور", + "Remember Me": "مرا به خاطر بسپار", + "Forgot Your Password?": "رمز عبورتان را فراموش کرده اید؟", + "Register": "ثبت نام", + "Name": "ثبت نام", + "Confirm Password": "تایید رمز عبور", + "Verify Your Email Address": "ایمیل خود را تایید کنید", + "A fresh verification link has been sent to your email address.": "یک لینک فعال سازی جدید به ادرس ایمیل شما ارسال شد.", + "Before proceeding, please check your email for a verification link.": "قبل از ادامه دادن لطفا ایمیل خود را برای فعال سازی حسابتان برسی کنید.", + "If you did not receive the email": "اگه ایمیلی دریافت نکرده اید", + "click here to request another": "برای درخواست لینک جدید اینجا کلیک کنید", + "Please confirm your password before continuing.": "لطفا برای ادامه رمز عبور خود را تایید کنید", + "Send Password Reset Link": "ارسال لینک بازیابی رمز عبور", + "Logout": "خروج", + "Dashboard": "داشبورد", + "Manage Account": "مدیریت حساب کاربری", + "Profile": "پروفایل", + "API Tokens": "توکن های api", + "Manage Team": "مدیریت تیم", + "Team Settings": "تنظیمات تیم", + "Create New Team": "ساخت تیم جدید", + "Switch Teams": "تعویض تیم", + "Delete Account": "حذف حساب کاربری", + "Permanently delete your account.": ".حذف دائمی حساب کاربری", + "Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.": "زمانی که حساب کاربریتان حذف شد، همه اطلاعات به صورت دائم حذف خواهد شد. قبل از حذف همه اطلاعات مورد نیاز خودتان را دانلود کنید.", + "Are you sure you want to delete your account? Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.": "آیا مطمئن هستید میخواهید حساب کاربریتان را حذف کنید؟ زمانی که حساب کاربریتان حذف شد، همه اطلاعات به صورت دائم حذف میشود. لطفا رمز عبور خود را برای حذف دائمی حسابتان وارد کنین.", + "Nevermind": "بیخیال", + "Browser Sessions": "دستگاه های فعال", + "Manage and logout your active sessions on other browsers and devices.": "مدیریت و خروج از بقیه دستگاه ها و براورز های فعال.", + "If necessary, you may logout of all of your other browser sessions across all of your devices. If you feel your account has been compromised, you should also update your password.": "اگر نیاز میدونید، میتوانید تمام دستگاه ها و براوزر های فعال این حساب غیر فعال کنید. اگر احساس میکنید حسابتان ممکن است در خطر هست بهتر است رمز عبورتان را هم اپدیت کنید.", + "This device": "این دستگاه", + "Last active": "آخرین زمان فعالیت", + "Done": "انجام شد.", + "Please enter your password to confirm you would like to logout of your other browser sessions across all of your devices.": "برای خروج از بقیه دستگاه ها رمز عبور خود را وارد کنید.", + "Logout Other Browser Sessions": "خروج از بقیه دستگاه ها", + "Two Factor Authentication": "احراز هویت دو فاکتور", + "Add additional security to your account using two factor authentication.": "امنیت بیشتری به حساب خود با استفاده از احراز هویت دو فاکتور اضافه کنید.", + "You have enabled two factor authentication.": "احراز هویت دو فاکتور شما فعال است.", + "You have not enabled two factor authentication.": "شما احراز هویت دو فاکتور را فعال نکرده اید!", + "When two factor authentication is enabled, you will be prompted for a secure, random token during authentication. You may retrieve this token from your phone's Google Authenticator application.": "زمانی که احراز هویت دو فاکتور فعال باشد، در هنگام احراز هویت از شما یک رمز امن و تصادفی درخواست می شود. شما می توانید این رمز را از برنامه Google Authenticator تلفن خود دریافت کنید.", + "Two factor authentication is now enabled. Scan the following QR code using your phone's authenticator application.": "احراز هویت دو فاکتور اکنون فعال شده است. کد QR زیر را با استفاده از برنامه authenticator خود اسکن کنید.", + "Store these recovery codes in a secure password manager. They can be used to recover access to your account if your two factor authentication device is lost.": "این کدهای بازیابی را در یک برنامه مدیریت رمز عبور امن ذخیره کنید. اگر دستگاه تأیید اعتبار دو فاکتور شما از بین رفته باشد ، می توان از آنها برای بازیابی دسترسی به حساب شما استفاده کرد.", + "Enable": "فعال کردن", + "Regenerate Recovery Codes": "تولید دوباره کد های بازیابی", + "Show Recovery Codes": "نمایش کد های بازیابی", + "Disable": "غیر فعال کردن", + "Update Password": "اپدیت رمز عبور", + "Ensure your account is using a long, random password to stay secure.": "اطمینان حاصل کنید که حساب شما از یک رمز عبور تصادفی طولانی برای ایمن ماندن استفاده می کند.", + "Current Password": "رمز عبور فعلی", + "New Password": "رمز عبور جدید", + "Saved.": "ذخیره شد.", + "Save": "ذخیره", + "Profile Information": "اطلاعات پروفایل", + "Update your account's profile information and email address.": "اطلاعات حساب کاربری و ایمیل خود را اپدیت کنید", + "Photo": "عکس", + "Select A New Photo": "انتخاب عکس جدید", + "Remove Photo": "حذف عکس", + "Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.": "رمز عبور خود را فراموش کرده اید؟ مشکلی نیست فقط آدرس ایمیل خود را وارد کنید و ما یک ایمیل تنظیم مجدد رمز عبور را برای شما ارسال خواهیم کرد که به شما امکان می دهد رمز عبور جدیدی را انتخاب کنید.", + "Email Password Reset Link": "ایمیل بازیابی رمز عبور", + "Email": "ایمیل", + "Remember me": "مرا به خاطر داشته باش", + "Forgot your password?": "رمز عبور خود را فراموش کرده اید؟", + "Already registered?": "قبلا ثبت نام کرده اید؟", + "Please confirm access to your account by entering the authentication code provided by your authenticator application.": "لطفاً با وارد کردن کد احراز هویت ارائه شده توسط برنامه تایید اعتبار، دسترسی به حساب خود را تأیید کنید.", + "Please confirm access to your account by entering one of your emergency recovery codes.": "لطفاً با وارد کردن یکی از کدهای بازیابی اضطراری، دسترسی به حساب خود را تأیید کنید.", + "Code": "کد", + "Recovery Code": "کد بازیابی", + "Use a recovery code": "استفاده از کد بازیابی", + "Use an authentication code": "استفاده از کد احراز هویت", + "Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn't receive the email, we will gladly send you another.": "از ثبت نام شما سپاسگزاریم! قبل از شروع، آیا می توانید آدرس ایمیل خود را با کلیک بر روی لینکی که برای شما فرستادیم، تأیید کنید؟ اگر ایمیل را دریافت نکردید ، ما با کمال میل ایمیل دیگری را برای شما ارسال خواهیم کرد.", + "A new verification link has been sent to the email address you provided during registration.": "لینک تأیید جدید به آدرس ایمیلی که هنگام ثبت نام وارد کرده اید ارسال شده است.", + "Resend Verification Email": "ارسال دوباره تایید ایمیل", + "Create API Token": "ساخت یک توکن", + "API tokens allow third-party services to authenticate with our application on your behalf.": "توکن های API به سرویس های شخص ثالث اجازه می دهد تا از طریق شما با برنامه ما احراز هویت شوند", + "Token Name": "اسم توکن", + "Permissions": "دسترسی ها", + "Created.": "ساخته شد.", + "Create": "ساختن", + "Manage API Tokens": "مدیریت توکن ها", + "You may delete any of your existing tokens if they are no longer needed.": "میتوانید هر یک از توکن های موجود را پاک کنید اگه نیازی به انها ندارید.", + "Last used": "اخرین زمان مورد استفاده", + "Delete": "حذف", + "Please copy your new API token. For your security, it won't be shown again.": "لطفا توکن API خود را کپی کنید. برای امنیت شما ، دوباره نمایش داده نمی شود.", + "Close": "بستن", + "API Token Permissions": "دسترسی های توکن", + "Delete API Token": "حذف توکن", + "Are you sure you would like to delete this API token?": "آیا از حذف این توکن مطمئن هستید؟", + "The :attribute must be a valid role": "فیلد :attribute باید نقش درستی داشته باشد", + "The provided two factor authentication code was invalid.": "رمز دوم شما درست نیست.", + "The provided password does not match your current password.": "رمز عبور وارد شده با رمز عبور حسابتان یکی نیست!", + "The :attribute must be at least :length characters and contain at least one uppercase character.": "فیلد :attribute باید حداقل :length کاراکتر و شامل حداقل یک حرف بزرگ باشد.", + "The :attribute must be at least :length characters and contain at least one number.": "فیلد :attribute باید حداقل :length کاراکتر و شامل حداقل یک عدد باشد.", + "The :attribute must be at least :length characters and contain at least one uppercase character and number.": "فیلد :attribute باید حداقل :length کاراکتر و شامل حداقل یک حرف بزرگ و یک عدد باشد.", + "The :attribute must be at least :length characters.": "فیلد :attribute باید حداقل :length کاراکتر باشد.", + "Team Details": "جزئیات تیم", + "Create a new team to collaborate with others on projects.": "یک تیم جدید برای همکاری با دیگران در پروژه ها ایجاد کنید.", + "Team Owner": "مالک تیم", + "Team Name": "نام تیم", + "Delete Team": "حذف تیم", + "Permanently delete this team.": "حذف دائمی این تیم.", + "Once a team is deleted, all of its resources and data will be permanently deleted. Before deleting this team, please download any data or information regarding this team that you wish to retain.": "پس از حذف یک تیم ، تمام منابع و داده های آن برای همیشه حذف می شوند. قبل از حذف این تیم ، لطفاً هرگونه اطلاعات یا اطلاعات مربوط به این تیم را که می خواهید حفظ کنید دانلود کنید.", + "Are you sure you want to delete this team? Once a team is deleted, all of its resources and data will be permanently deleted.": "آیا مطمئن هستید که می خواهید این تیم را حذف کنید؟ پس از حذف یک تیم ، تمام منابع و داده های آن برای همیشه حذف می شوند.", + "Add Team Member": "افزودن عضو تیم", + "Add a new team member to your team, allowing them to collaborate with you.": "عضوی جدید از تیم را به تیم خود اضافه کنید و به وی اجازه دهید با شما همکاری کند.", + "Please provide the email address of the person you would like to add to this team. The email address must be associated with an existing account.": "لطفاً آدرس ایمیل شخصی را که می خواهید به این تیم اضافه کنید ، وارد کنید. آدرس ایمیل باید با یک حساب موجود مرتبط باشد.", + "Role": "نقش", + "Added.": "اضافه شد", + "Add": "اضافه", + "Team Members": "اعضای تیم", + "All of the people that are part of this team.": "همه افرادی که در این تیم عضو هستند.", + "Leave": "رفتن", + "Remove": "پاک کردن", + "Manage Role": "مدیریت نقش", + "Leave Team": "ترک کردن تیم", + "Are you sure you would like to leave this team?": "آیا مطمئن هستید که می خواهید این تیم را ترک کنید؟", + "Remove Team Member": "حذف عضو تیم", + "Are you sure you would like to remove this person from the team?": "آیا مطمئن هستید که می خواهید این شخص را از تیم حذف کنید؟", + "The team's name and owner information.": "نام تیم و اطلاعات مالک آن.", + "You may not leave a team that you created.": "نمیتوانید از تیم خودتان خارج شوید.", + "You may not delete your personal team.": "نمیتوانید تیم خودتان را حذف کنید.", + "This password does not match our records.": "این رمز عبور با اطلاعات ما مطابق نیست.", + "The :attribute must be a valid role.": "فیلد :attribute باید یک نقش درست باشد.", + "The :attribute must be at least :length characters and contain at least one special character.": "فیلد :attribute باید حداقل :length کاراکتر و شامل یک کاراکتر مخصوص باشد.", + "The :attribute must be at least :length characters and contain at least one uppercase character and one special character.": "فیلد :attribute باید حداقل :length کاراکتر و شامل یک کاراکتر مخصوص و یک حرف بزرگ باشد.", + "The :attribute must be at least :length characters and contain at least one uppercase character, one number, and one special character.": "فیلد :attribute باید حداقل :length کاراکتر، یک کاراکتر مخصوص، یک حرف بزرگ و یک عدد باشد." +} \ No newline at end of file diff --git a/backend/resources/lang/fa/auth.php b/backend/resources/lang/fa/auth.php new file mode 100644 index 00000000..8e208f0a --- /dev/null +++ b/backend/resources/lang/fa/auth.php @@ -0,0 +1,19 @@ + 'اطلاعات وارد شده صحیح نمی باشد.', + 'throttle' => 'تعداد تلاش های ناموفق زیاد بود . لطفا بعد از :seconds ثانیه ی دیگر تلاش کنید .', + +]; \ No newline at end of file diff --git a/backend/resources/lang/fa/messages.php b/backend/resources/lang/fa/messages.php new file mode 100644 index 00000000..ddab3323 --- /dev/null +++ b/backend/resources/lang/fa/messages.php @@ -0,0 +1,7 @@ + 'عملیات موفق آمیز بود', + 'incorrect_current_password' => 'رمز عبور فعلی اشتباه است', + 'incorrect_or_username_password' => 'رمز عبور یا نام کاربری اشتباه است' +]; diff --git a/backend/resources/lang/fa/pagination.php b/backend/resources/lang/fa/pagination.php new file mode 100644 index 00000000..0e75c41f --- /dev/null +++ b/backend/resources/lang/fa/pagination.php @@ -0,0 +1,19 @@ + '« قبلی', + 'next' => 'بعدی »', + +]; \ No newline at end of file diff --git a/backend/resources/lang/fa/passwords.php b/backend/resources/lang/fa/passwords.php new file mode 100644 index 00000000..c3f4fae9 --- /dev/null +++ b/backend/resources/lang/fa/passwords.php @@ -0,0 +1,22 @@ + 'رمز عبور شما با موفقیت تغییر یافت!', + 'sent' => 'لینک تغییر رمز عبور برای شما فرستاده شد!', + 'throttled' => 'لطفا قبل تلاش مجدد منتظر بمانید.', + 'token' => 'token تغییر گذر واژه (لینک) نامعتبر است.', + 'user' => "کاربری با این ایمیل یافت نشد.", + +]; \ No newline at end of file diff --git a/backend/resources/lang/fa/validation.php b/backend/resources/lang/fa/validation.php new file mode 100644 index 00000000..d58a36b0 --- /dev/null +++ b/backend/resources/lang/fa/validation.php @@ -0,0 +1,292 @@ + ':attribute در این حالت مجاز نیست.', + "accepted" => ":attribute باید پذیرفته شده باشد.", + "active_url" => "آدرس :attribute معتبر نیست", + "after" => ":attribute باید بعد از :date باشد.", + 'after_or_equal' => ':attribute باید بعد از یا برابر تاریخ :date باشد.', + "alpha" => ":attribute باید شامل حروف الفبا باشد.", + "alpha_dash" => ":attribute باید شامل حروف الفبا و عدد و خظ تیره(-) باشد.", + "alpha_num" => ":attribute باید شامل حروف الفبا و عدد باشد.", + "array" => ":attribute باید شامل آرایه باشد.", + "before" => ":attribute باید تاریخی قبل از :date باشد.", + 'before_or_equal' => ':attribute باید قبل از یا برابر تاریخ :date باشد.', + "between" => [ + "numeric" => ":attribute باید بین :min و :max باشد.", + "file" => ":attribute باید بین :min و :max کیلوبایت باشد.", + "string" => ":attribute باید بین :min و :max کاراکتر باشد.", + "array" => ":attribute باید بین :min و :max آیتم باشد.", + ], + "boolean" => "فیلد :attribute فقط میتواند صحیح و یا غلط باشد", + "confirmed" => ":attribute با تاییدیه مطابقت ندارد.", + "date" => ":attribute یک تاریخ معتبر نیست.", + 'date_equals' => ':attribute باید برابر تاریخ :date باشد.', + "date_format" => ":attribute با الگوی :format مطاقبت ندارد.", + "different" => ":attribute و :other باید متفاوت باشند.", + "digits" => ":attribute باید :digits رقم باشد.", + "digits_between" => ":attribute باید بین :min و :max رقم باشد.", + 'dimensions' => 'dimensions مربوط به فیلد :attribute اشتباه است.', + 'distinct' => ':attribute مقدار تکراری دارد.', + "email" => "فرمت :attribute معتبر نیست.", + 'ends_with' => ':attribute باید با این مقدار تمام شود: :values.', + "exists" => ":attribute انتخاب شده، معتبر نیست.", + 'file' => 'فیلد :attribute باید فایل باشد.', + "filled" => "فیلد :attribute الزامی است", + 'gt' => [ + 'numeric' => ':attribute باید بیشتر از :value باشد.', + 'file' => ':attribute باید بیشتر از :value کیلوبایت باشد.', + 'string' => ':attribute باید بیشتر از :value کاراکتر باشد.', + 'array' => ':attribute باید بیشتر از :value ایتم باشد.', + ], + 'gte' => [ + 'numeric' => ':attribute باید بیشتر یا برابر :value باشد.', + 'file' => ':attribute باید بیشتر یا برابر :value کیلوبایت باشد.', + 'string' => ':attribute باید بیشتر یا برابر :value کاراکتر باشد.', + 'array' => ':attribute باید :value ایتم یا بیشتر را داشته باشد.', + ], + "image" => ":attribute باید تصویر باشد.", + "in" => ":attribute انتخاب شده، معتبر نیست.", + "integer" => ":attribute باید نوع داده ای عددی (integer) باشد.", + "ip" => ":attribute باید IP آدرس معتبر باشد.", + 'ipv4' => ':attribute باید یک ادرس درست IPv4 باشد.', + 'ipv6' => ':attribute باید یک ادرس درست IPv6 باشد.', + 'json' => ':attribute یک مقدار درست JSON باشد.', + 'lt' => [ + 'numeric' => ':attribute باید کمتر از :value باشد.', + 'file' => ':attribute باید کمتر از :value کیلوبایت باشد.', + 'string' => ':attribute باید کمتر از :value کاراکتر باشد.', + 'array' => ':attribute باید :value ایتم یا کمتر را داشته باشد.', + ], + 'lte' => [ + 'numeric' => ':attribute باید کمتر یا برابر :value باشد.', + 'file' => ':attribute باید کمتر یا برابر :value کیلوبایت باشد.', + 'string' => ':attribute باید کمتر یا برابر :value کاراکتر باشد.', + 'array' => ':attribute باید :value ایتم یا کمتر را داشته باشد.', + ], + "max" => [ + "numeric" => ":attribute نباید بزرگتر از :max باشد.", + "file" => ":attribute نباید بزرگتر از :max کیلوبایت باشد.", + "string" => ":attribute نباید بیشتر از :max کاراکتر باشد.", + "array" => ":attribute نباید بیشتر از :max آیتم باشد.", + ], + "mimes" => ":attribute باید یکی از فرمت های :values باشد.", + 'mimetypes' => ':attribute باید تایپ ان از نوع: :values باشد.', + "min" => [ + "numeric" => ":attribute نباید کوچکتر از :min باشد.", + "file" => ":attribute نباید کوچکتر از :min کیلوبایت باشد.", + "string" => ":attribute نباید کمتر از :min کاراکتر باشد.", + "array" => ":attribute نباید کمتر از :min آیتم باشد.", + ], + "not_in" => ":attribute انتخاب شده، معتبر نیست.", + 'not_regex' => ':attribute فرمت معتبر نیست.', + "numeric" => ":attribute باید شامل عدد باشد.", + 'password' => 'رمز عبور اشتباه است.', + 'present' => ':attribute باید وجود داشته باشد.', + "regex" => ":attribute یک فرمت معتبر نیست", + "required" => "فیلد :attribute الزامی است", + "required_if" => "فیلد :attribute هنگامی که :other برابر با :value است، الزامیست.", + 'required_unless' => 'قیلد :attribute الزامیست مگر این فیلد :other مقدارش :values باشد.', + "required_with" => ":attribute الزامی است زمانی که :values موجود است.", + "required_with_all" => ":attribute الزامی است زمانی که :values موجود است.", + "required_without" => ":attribute الزامی است زمانی که :values موجود نیست.", + "required_without_all" => ":attribute الزامی است زمانی که :values موجود نیست.", + "same" => ":attribute و :other باید مانند هم باشند.", + "size" => [ + "numeric" => ":attribute باید برابر با :size باشد.", + "file" => ":attribute باید برابر با :size کیلوبایت باشد.", + "string" => ":attribute باید برابر با :size کاراکتر باشد.", + "array" => ":attribute باسد شامل :size آیتم باشد.", + ], + 'starts_with' => ':attribute باید با یکی از این مقادیر شروع شود: :values.', + "string" => ":attribute باید رشته باشد.", + "timezone" => "فیلد :attribute باید یک منطقه صحیح باشد.", + "unique" => ":attribute قبلا انتخاب شده است.", + 'uploaded' => 'فیلد :attribute به درستی اپلود نشد.', + "url" => "فرمت آدرس :attribute اشتباه است.", + 'uuid' => ':attribute باید یک فرمت درست UUID باشد.', + + /* + |-------------------------------------------------------------------------- + | Custom Validation Language Lines + |-------------------------------------------------------------------------- + | + | Here you may specify custom validation messages for attributes using the + | convention "attribute.rule" to name the lines. This makes it quick to + | specify a specific custom language line for a given attribute rule. + | + */ + + 'custom' => [], + + /* + |-------------------------------------------------------------------------- + | Custom Validation Attributes + |-------------------------------------------------------------------------- + | + | The following language lines are used to swap attribute place-holders + | with something more reader friendly such as E-Mail Address instead + | of "email". This simply helps us make messages a little cleaner. + | + */ + 'attributes' => [ + "name" => "نام", + "username" => "نام کاربری", + "national_code" => "کد ملی", + "email" => "پست الکترونیکی", + "first_name" => "نام", + "last_name" => "نام خانوادگی", + "family" => "نام خانوادگی", + "password" => "رمز عبور", + "password_confirmation" => "تاییدیه ی رمز عبور", + "city" => "شهر", + "country" => "کشور", + "address" => "نشانی", + "phone" => "تلفن", + "mobile" => "تلفن همراه", + "age" => "سن", + "sex" => "جنسیت", + "gender" => "جنسیت", + "day" => "روز", + "month" => "ماه", + "year" => "سال", + "hour" => "ساعت", + "minute" => "دقیقه", + "second" => "ثانیه", + "title" => "عنوان", + "text" => "متن", + "content" => "محتوا", + "description" => "توضیحات", + "excerpt" => "گلچین کردن", + "date" => "تاریخ", + "time" => "زمان", + "available" => "موجود", + "size" => "اندازه", + "file" => "فایل", + "fullname" => "نام کامل", + 'current_password' => 'رمز عبور فعلی', + 'new_password' => 'رمز عبور جدید', + 'degree' => 'مدرک تحصیلی', + 'major' => 'شغل', + 'avatar' => 'آواتار', + 'lat' => 'طول جغرافیایی', + 'lng' => 'عرض جغرافیایی', + 'azmayesh_type_id' => 'نوع آزمایش', + 'request_date' => 'تاریخ درخواست', + 'report_date' => 'تاریخ گزارش', + 'request_number' => 'شماره درخواست', + 'employer' => 'کارفرما', + 'contractor' => 'پیمانکار', + 'work_number' => 'شماره کار', + 'project_name' => 'نام پروژه', + 'consultant' => 'مشاور', + 'applicant' => 'متقاضی', + 'province_id' => 'استان', + 'azmayesh_id' => 'آزمایش', + 'data' => 'داده', + 'fields' => 'فیلد ها', + 'fields.*.name' => 'نام فیلد', + 'fields.*.unit' => 'واحد فیلد', + 'fields.*.type' => 'نوع فیلد', + 'fields.*.option' => 'گزینه های فیلد', + 'cmms_machine_id' => 'کد یکتا ماشین', + 'contract_subitem_id' => 'کد یکتای پروژه', + 'base_price' => 'قیمت پایه', + 'unit' => 'واحد', + 'phone_number'=> 'شماره تلفن', + 'final_description' => 'توضیحات نهایی', + 'point' => 'منطقه' , + 'info_id' => 'دسته بندی' , + 'activity_date' => 'تاریخ فعالیت', + 'activity_time' => 'زمان فعالیت', + 'recognize_picture' => 'عکس بازدید', + 'recognize_picture_second' => 'عکس بازدید', + 'axis_type_id' => 'نوع محور', + 'supervisor_description' => 'توضیحات کارشناس', + 'need_judiciary' => 'دستور قضایی' , + 'operator_description' => 'توضیحات ناظر', + 'judiciary_document' => 'فایل دستور قضایی', + 'action_picture' => 'عکس اقدامات', + 'finish_picture' => 'عکس پایان کار', + 'action_date' => 'زمان فالیت', + 'evidence_picture' => 'تصویر مشاهده شده', + 'deposit_insurance_image' => 'عکس مبلغ بیمه', + 'deposit_insurance_amount' => ' مبلغ بیمه', + 'deposit_daghi_image' => 'عکس مبلغ بیمه', + 'deposit_daghi_amount' => 'مبلغ داغی', + 'is_foreign' => 'ناوگان خارجی', + 'axis_name' => 'نام محور', + 'driver_name' => 'اسم راننده', + 'plaque' => 'پلاک', + 'driver_national_code' => 'کدملی راننده', + 'driver_phone_number' => 'شماره موبایل راننده', + 'accident_type' => 'نوع خسارت', + 'accident_date' => 'تاریخ تصادف', + 'accident_time' => 'زمان تصادف', + 'report_base' => 'گزارش', + 'police_file' => 'تصویر کروکی یا نامه پلیس راه', + 'police_serial' => 'شماره کروکی یا نامه پلیس راه', + 'police_file_date' => 'تاریخ کروکی یا نامه پلیس راه', + 'damage_picture1' => 'عکس تصادف', + 'damage_picture2' => 'عکس تصادف', + 'damage_items' => 'ایتم های خسارت', + 'damage_items.*.value' => 'میزان ایتم های خسارت', + 'damage_items.*.amount' => 'هزینه خسارت', + 'driver_rate' => 'سهم راننده', + 'code' => 'کد', + 'rahdaran' => 'افراد', + 'machines' => 'خودرو', + 'driver' => 'راننده', + 'zone' => 'منطقه', + 'start_date' => 'تاریخ شروع', + 'end_date' => 'تاریخ پایان', + 'end_point' => 'مقصد', + 'area' => 'منطقه عملیاتی', + 'area.type' => 'نوع محدوده' , + 'area.coordinates' => 'مختصات محدوده', + 'category_id' => 'دسته بندی', + 'explanation' => 'توضیحات', + 'requested_machines' => 'ماشین های درخواستی', + 'type' => 'نوع', + 'road_observed_id' => 'کد واکنش سریع', + 'city_id' => 'شهر', + 'expert_description' => 'توضیح کارشناس', + 'need_payment' => 'نیاز به پرداخت', + 'request_id' => 'شناسه درخواست', + 'access_road' => 'راه دسترسی', + 'access_road.type' => 'نوع راه دسترسی', + 'access_road.coordinates' => 'مختصات راه دسترسی', + 'final_area' => 'محدوده نهایی', + 'final_area.type' => 'نوع محدوده نهایی', + 'final_area.coordinates' => 'مختصات محدوده نهایی', + 'final_plan' => 'طرح نهایی', + 'final_plan.type' => 'نوع طرح نهایی', + 'final_plan.coordinate' => 'مختصات طرح نهایی', + 'national_id' => 'کد ملی' , + 'requested_organization' => 'سازمان درخواست‌کننده', + 'plan_group' => 'گروه طرح', + 'plan_title' => 'موضوع طرح', + 'worksheet' => 'شناسه کاربرگ', + 'response_options' => 'گزینه های پاسخ', + 'isic' => 'کد ISIC', + 'primary_area' => 'محدوده اولیه', + 'primary_area.type' => 'نوع محدوده اولیه', + 'primary_area.coordinates' => 'مختصات محدوده اولیه', + 'forbidden_area' => 'محدوده ممنوعه', + 'forbidden_area.type' => 'نوع محدوده محدوده', + 'forbidden_area.coordinates' => 'مختصات محدوده ممنوعه', + 'edarate_ostani_id' => 'اداره استانی', + 'edarate_shahri_id' => ' اداره شهری' + ], +]; diff --git a/backend/routes/api.php b/backend/routes/api.php old mode 100644 new mode 100755 index fa658a85..56897756 --- a/backend/routes/api.php +++ b/backend/routes/api.php @@ -8,13 +8,3 @@ Route::get('/user', function (Request $request) { return $request->user(); })->middleware('auth:api'); -Route::prefix('user')->group(function () { - Route::prefix('Auth') - ->name('Auth') - ->controller(AuthController::class) - ->group(function () { - Route::post('register', 'register')->name('register'); - Route::post('login', 'login')->name('login'); - Route::post('logout', 'logout')->middleware('auth:api')->name('logout'); - }); -}); diff --git a/backend/routes/web.php b/backend/routes/web.php old mode 100644 new mode 100755 index 86a06c53..ba0244c3 --- a/backend/routes/web.php +++ b/backend/routes/web.php @@ -1,7 +1,22 @@ 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'); + }); +Route::prefix('profile') + ->name('profile.') + ->controller(ProfileController::class) + ->group(function () { + Route::get('info', 'info')->name('info'); + Route::post('edit', 'edit')->name('edit'); + Route::post('change_password', 'changePassword')->name('changePassword'); + }); From f01992368e01f89efaa95881512af1158181417d Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Wed, 6 May 2026 09:12:29 +0330 Subject: [PATCH 09/10] create user info --- .../User/Controller/Auth/AuthController.php | 6 +- .../app/User/Controller/ProfileController.php | 9 +- .../User/Requests/Auth/RegisterRequest.php | 2 +- .../{Http => User}/Resources/UserResource.php | 2 +- backend/resources/lang/fa.json | 137 ------------------ backend/routes/web.php | 2 + 6 files changed, 8 insertions(+), 150 deletions(-) rename backend/app/{Http => User}/Resources/UserResource.php (93%) delete mode 100644 backend/resources/lang/fa.json diff --git a/backend/app/User/Controller/Auth/AuthController.php b/backend/app/User/Controller/Auth/AuthController.php index d8b59502..cbd4f33d 100755 --- a/backend/app/User/Controller/Auth/AuthController.php +++ b/backend/app/User/Controller/Auth/AuthController.php @@ -3,11 +3,11 @@ namespace App\User\Controller\Auth; use App\Http\Controllers\Controller; -use App\Http\Resources\UserResource; use App\Models\User; use App\Traits\ApiResponse; use App\User\Requests\Auth\LoginRequest; use App\User\Requests\Auth\RegisterRequest; +use App\User\Resources\UserResource; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -46,9 +46,7 @@ class AuthController extends Controller $user = Auth::user(); - return $this->successResponse([ - 'info' => new UserResource($user), - ]); + return $this->successResponse(new UserResource($user)); } return $this->errorResponse(__('messages.incorrect_or_username_password')); diff --git a/backend/app/User/Controller/ProfileController.php b/backend/app/User/Controller/ProfileController.php index b3aa09ce..c3c07706 100644 --- a/backend/app/User/Controller/ProfileController.php +++ b/backend/app/User/Controller/ProfileController.php @@ -3,10 +3,10 @@ namespace App\User\Controller; use App\Http\Controllers\Controller; -use App\Http\Resources\UserResource; use App\Traits\ApiResponse; use App\User\Requests\Profile\ChangePasswordRequest; use App\User\Requests\Profile\EditRequest; +use App\User\Resources\UserResource; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; @@ -17,11 +17,7 @@ class ProfileController extends Controller public function info(): JsonResponse { - $user = Auth::user(); - - return $this->successResponse([ - 'info' => new UserResource($user), - ]); + return $this->successResponse(new UserResource(Auth::user())); } public function edit(EditRequest $request): JsonResponse @@ -56,6 +52,5 @@ class ProfileController extends Controller ]); return $this->successResponse(); - } } diff --git a/backend/app/User/Requests/Auth/RegisterRequest.php b/backend/app/User/Requests/Auth/RegisterRequest.php index 97667b23..1c8055fe 100755 --- a/backend/app/User/Requests/Auth/RegisterRequest.php +++ b/backend/app/User/Requests/Auth/RegisterRequest.php @@ -24,7 +24,7 @@ class RegisterRequest extends FormRequest return [ 'username' => 'required|unique:users,username', 'email' => 'required|email|unique:users,email', - 'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:6', + 'password' => 'required|string|regex:/^(?=.*[a-zA-Z])(?=.*\d).+$/|min:6|confirmed:', ]; } } diff --git a/backend/app/Http/Resources/UserResource.php b/backend/app/User/Resources/UserResource.php similarity index 93% rename from backend/app/Http/Resources/UserResource.php rename to backend/app/User/Resources/UserResource.php index 30459058..55f98563 100755 --- a/backend/app/Http/Resources/UserResource.php +++ b/backend/app/User/Resources/UserResource.php @@ -1,6 +1,6 @@ name('login'); Route::post('logout', 'logout')->name('logout'); }); + Route::prefix('profile') ->name('profile.') + ->middleware('auth') ->controller(ProfileController::class) ->group(function () { Route::get('info', 'info')->name('info'); From f072bd1ee8075059a0482f242318d0ad4147d255 Mon Sep 17 00:00:00 2001 From: faezehzafarbakhsh Date: Wed, 6 May 2026 09:16:35 +0330 Subject: [PATCH 10/10] delete lan --- backend/resources/lang/en/auth.php | 19 -- backend/resources/lang/en/messages.php | 7 - backend/resources/lang/en/pagination.php | 19 -- backend/resources/lang/en/passwords.php | 22 -- backend/resources/lang/en/validation.php | 151 ------------ backend/resources/lang/fa/auth.php | 19 -- backend/resources/lang/fa/messages.php | 7 - backend/resources/lang/fa/pagination.php | 19 -- backend/resources/lang/fa/passwords.php | 22 -- backend/resources/lang/fa/validation.php | 292 ----------------------- 10 files changed, 577 deletions(-) delete mode 100644 backend/resources/lang/en/auth.php delete mode 100644 backend/resources/lang/en/messages.php delete mode 100644 backend/resources/lang/en/pagination.php delete mode 100644 backend/resources/lang/en/passwords.php delete mode 100644 backend/resources/lang/en/validation.php delete mode 100644 backend/resources/lang/fa/auth.php delete mode 100644 backend/resources/lang/fa/messages.php delete mode 100644 backend/resources/lang/fa/pagination.php delete mode 100644 backend/resources/lang/fa/passwords.php delete mode 100644 backend/resources/lang/fa/validation.php diff --git a/backend/resources/lang/en/auth.php b/backend/resources/lang/en/auth.php deleted file mode 100644 index e5506df2..00000000 --- a/backend/resources/lang/en/auth.php +++ /dev/null @@ -1,19 +0,0 @@ - 'These credentials do not match our records.', - 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', - -]; diff --git a/backend/resources/lang/en/messages.php b/backend/resources/lang/en/messages.php deleted file mode 100644 index 2d88fb58..00000000 --- a/backend/resources/lang/en/messages.php +++ /dev/null @@ -1,7 +0,0 @@ - 'The Operation was successful', - 'incorrect_current_password' => 'The current password is incorrect.', - 'incorrect_or_username_password' => 'The username or password is incorrect.', -]; diff --git a/backend/resources/lang/en/pagination.php b/backend/resources/lang/en/pagination.php deleted file mode 100644 index d4814118..00000000 --- a/backend/resources/lang/en/pagination.php +++ /dev/null @@ -1,19 +0,0 @@ - '« Previous', - 'next' => 'Next »', - -]; diff --git a/backend/resources/lang/en/passwords.php b/backend/resources/lang/en/passwords.php deleted file mode 100644 index 724de4b9..00000000 --- a/backend/resources/lang/en/passwords.php +++ /dev/null @@ -1,22 +0,0 @@ - 'Your password has been reset!', - 'sent' => 'We have e-mailed your password reset link!', - 'throttled' => 'Please wait before retrying.', - 'token' => 'This password reset token is invalid.', - 'user' => "We can't find a user with that e-mail address.", - -]; diff --git a/backend/resources/lang/en/validation.php b/backend/resources/lang/en/validation.php deleted file mode 100644 index a65914f9..00000000 --- a/backend/resources/lang/en/validation.php +++ /dev/null @@ -1,151 +0,0 @@ - 'The :attribute must be accepted.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ - 'numeric' => 'The :attribute must be between :min and :max.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'string' => 'The :attribute must be between :min and :max characters.', - 'array' => 'The :attribute must have between :min and :max items.', - ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'date' => 'The :attribute is not a valid date.', - 'date_equals' => 'The :attribute must be a date equal to :date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'email' => 'The :attribute must be a valid email address.', - 'ends_with' => 'The :attribute must end with one of the following: :values.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field must have a value.', - 'gt' => [ - 'numeric' => 'The :attribute must be greater than :value.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'string' => 'The :attribute must be greater than :value characters.', - 'array' => 'The :attribute must have more than :value items.', - ], - 'gte' => [ - 'numeric' => 'The :attribute must be greater than or equal :value.', - 'file' => 'The :attribute must be greater than or equal :value kilobytes.', - 'string' => 'The :attribute must be greater than or equal :value characters.', - 'array' => 'The :attribute must have :value items or more.', - ], - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'lt' => [ - 'numeric' => 'The :attribute must be less than :value.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'string' => 'The :attribute must be less than :value characters.', - 'array' => 'The :attribute must have less than :value items.', - ], - 'lte' => [ - 'numeric' => 'The :attribute must be less than or equal :value.', - 'file' => 'The :attribute must be less than or equal :value kilobytes.', - 'string' => 'The :attribute must be less than or equal :value characters.', - 'array' => 'The :attribute must not have more than :value items.', - ], - 'max' => [ - 'numeric' => 'The :attribute may not be greater than :max.', - 'file' => 'The :attribute may not be greater than :max kilobytes.', - 'string' => 'The :attribute may not be greater than :max characters.', - 'array' => 'The :attribute may not have more than :max items.', - ], - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ - 'numeric' => 'The :attribute must be at least :min.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'string' => 'The :attribute must be at least :min characters.', - 'array' => 'The :attribute must have at least :min items.', - ], - 'not_in' => 'The selected :attribute is invalid.', - 'not_regex' => 'The :attribute format is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'password' => 'The password is incorrect.', - 'present' => 'The :attribute field must be present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values are present.', - 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size' => [ - 'numeric' => 'The :attribute must be :size.', - 'file' => 'The :attribute must be :size kilobytes.', - 'string' => 'The :attribute must be :size characters.', - 'array' => 'The :attribute must contain :size items.', - ], - 'starts_with' => 'The :attribute must start with one of the following: :values.', - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'url' => 'The :attribute format is invalid.', - 'uuid' => 'The :attribute must be a valid UUID.', - - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute.rule" to name the lines. This makes it quick to - | specify a specific custom language line for a given attribute rule. - | - */ - - 'custom' => [ - 'attribute-name' => [ - 'rule-name' => 'custom-message', - ], - ], - - /* - |-------------------------------------------------------------------------- - | Custom Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap our attribute placeholder - | with something more reader friendly such as "E-Mail Address" instead - | of "email". This simply helps us make our message more expressive. - | - */ - - 'attributes' => [], - -]; diff --git a/backend/resources/lang/fa/auth.php b/backend/resources/lang/fa/auth.php deleted file mode 100644 index 8e208f0a..00000000 --- a/backend/resources/lang/fa/auth.php +++ /dev/null @@ -1,19 +0,0 @@ - 'اطلاعات وارد شده صحیح نمی باشد.', - 'throttle' => 'تعداد تلاش های ناموفق زیاد بود . لطفا بعد از :seconds ثانیه ی دیگر تلاش کنید .', - -]; \ No newline at end of file diff --git a/backend/resources/lang/fa/messages.php b/backend/resources/lang/fa/messages.php deleted file mode 100644 index ddab3323..00000000 --- a/backend/resources/lang/fa/messages.php +++ /dev/null @@ -1,7 +0,0 @@ - 'عملیات موفق آمیز بود', - 'incorrect_current_password' => 'رمز عبور فعلی اشتباه است', - 'incorrect_or_username_password' => 'رمز عبور یا نام کاربری اشتباه است' -]; diff --git a/backend/resources/lang/fa/pagination.php b/backend/resources/lang/fa/pagination.php deleted file mode 100644 index 0e75c41f..00000000 --- a/backend/resources/lang/fa/pagination.php +++ /dev/null @@ -1,19 +0,0 @@ - '« قبلی', - 'next' => 'بعدی »', - -]; \ No newline at end of file diff --git a/backend/resources/lang/fa/passwords.php b/backend/resources/lang/fa/passwords.php deleted file mode 100644 index c3f4fae9..00000000 --- a/backend/resources/lang/fa/passwords.php +++ /dev/null @@ -1,22 +0,0 @@ - 'رمز عبور شما با موفقیت تغییر یافت!', - 'sent' => 'لینک تغییر رمز عبور برای شما فرستاده شد!', - 'throttled' => 'لطفا قبل تلاش مجدد منتظر بمانید.', - 'token' => 'token تغییر گذر واژه (لینک) نامعتبر است.', - 'user' => "کاربری با این ایمیل یافت نشد.", - -]; \ No newline at end of file diff --git a/backend/resources/lang/fa/validation.php b/backend/resources/lang/fa/validation.php deleted file mode 100644 index d58a36b0..00000000 --- a/backend/resources/lang/fa/validation.php +++ /dev/null @@ -1,292 +0,0 @@ - ':attribute در این حالت مجاز نیست.', - "accepted" => ":attribute باید پذیرفته شده باشد.", - "active_url" => "آدرس :attribute معتبر نیست", - "after" => ":attribute باید بعد از :date باشد.", - 'after_or_equal' => ':attribute باید بعد از یا برابر تاریخ :date باشد.', - "alpha" => ":attribute باید شامل حروف الفبا باشد.", - "alpha_dash" => ":attribute باید شامل حروف الفبا و عدد و خظ تیره(-) باشد.", - "alpha_num" => ":attribute باید شامل حروف الفبا و عدد باشد.", - "array" => ":attribute باید شامل آرایه باشد.", - "before" => ":attribute باید تاریخی قبل از :date باشد.", - 'before_or_equal' => ':attribute باید قبل از یا برابر تاریخ :date باشد.', - "between" => [ - "numeric" => ":attribute باید بین :min و :max باشد.", - "file" => ":attribute باید بین :min و :max کیلوبایت باشد.", - "string" => ":attribute باید بین :min و :max کاراکتر باشد.", - "array" => ":attribute باید بین :min و :max آیتم باشد.", - ], - "boolean" => "فیلد :attribute فقط میتواند صحیح و یا غلط باشد", - "confirmed" => ":attribute با تاییدیه مطابقت ندارد.", - "date" => ":attribute یک تاریخ معتبر نیست.", - 'date_equals' => ':attribute باید برابر تاریخ :date باشد.', - "date_format" => ":attribute با الگوی :format مطاقبت ندارد.", - "different" => ":attribute و :other باید متفاوت باشند.", - "digits" => ":attribute باید :digits رقم باشد.", - "digits_between" => ":attribute باید بین :min و :max رقم باشد.", - 'dimensions' => 'dimensions مربوط به فیلد :attribute اشتباه است.', - 'distinct' => ':attribute مقدار تکراری دارد.', - "email" => "فرمت :attribute معتبر نیست.", - 'ends_with' => ':attribute باید با این مقدار تمام شود: :values.', - "exists" => ":attribute انتخاب شده، معتبر نیست.", - 'file' => 'فیلد :attribute باید فایل باشد.', - "filled" => "فیلد :attribute الزامی است", - 'gt' => [ - 'numeric' => ':attribute باید بیشتر از :value باشد.', - 'file' => ':attribute باید بیشتر از :value کیلوبایت باشد.', - 'string' => ':attribute باید بیشتر از :value کاراکتر باشد.', - 'array' => ':attribute باید بیشتر از :value ایتم باشد.', - ], - 'gte' => [ - 'numeric' => ':attribute باید بیشتر یا برابر :value باشد.', - 'file' => ':attribute باید بیشتر یا برابر :value کیلوبایت باشد.', - 'string' => ':attribute باید بیشتر یا برابر :value کاراکتر باشد.', - 'array' => ':attribute باید :value ایتم یا بیشتر را داشته باشد.', - ], - "image" => ":attribute باید تصویر باشد.", - "in" => ":attribute انتخاب شده، معتبر نیست.", - "integer" => ":attribute باید نوع داده ای عددی (integer) باشد.", - "ip" => ":attribute باید IP آدرس معتبر باشد.", - 'ipv4' => ':attribute باید یک ادرس درست IPv4 باشد.', - 'ipv6' => ':attribute باید یک ادرس درست IPv6 باشد.', - 'json' => ':attribute یک مقدار درست JSON باشد.', - 'lt' => [ - 'numeric' => ':attribute باید کمتر از :value باشد.', - 'file' => ':attribute باید کمتر از :value کیلوبایت باشد.', - 'string' => ':attribute باید کمتر از :value کاراکتر باشد.', - 'array' => ':attribute باید :value ایتم یا کمتر را داشته باشد.', - ], - 'lte' => [ - 'numeric' => ':attribute باید کمتر یا برابر :value باشد.', - 'file' => ':attribute باید کمتر یا برابر :value کیلوبایت باشد.', - 'string' => ':attribute باید کمتر یا برابر :value کاراکتر باشد.', - 'array' => ':attribute باید :value ایتم یا کمتر را داشته باشد.', - ], - "max" => [ - "numeric" => ":attribute نباید بزرگتر از :max باشد.", - "file" => ":attribute نباید بزرگتر از :max کیلوبایت باشد.", - "string" => ":attribute نباید بیشتر از :max کاراکتر باشد.", - "array" => ":attribute نباید بیشتر از :max آیتم باشد.", - ], - "mimes" => ":attribute باید یکی از فرمت های :values باشد.", - 'mimetypes' => ':attribute باید تایپ ان از نوع: :values باشد.', - "min" => [ - "numeric" => ":attribute نباید کوچکتر از :min باشد.", - "file" => ":attribute نباید کوچکتر از :min کیلوبایت باشد.", - "string" => ":attribute نباید کمتر از :min کاراکتر باشد.", - "array" => ":attribute نباید کمتر از :min آیتم باشد.", - ], - "not_in" => ":attribute انتخاب شده، معتبر نیست.", - 'not_regex' => ':attribute فرمت معتبر نیست.', - "numeric" => ":attribute باید شامل عدد باشد.", - 'password' => 'رمز عبور اشتباه است.', - 'present' => ':attribute باید وجود داشته باشد.', - "regex" => ":attribute یک فرمت معتبر نیست", - "required" => "فیلد :attribute الزامی است", - "required_if" => "فیلد :attribute هنگامی که :other برابر با :value است، الزامیست.", - 'required_unless' => 'قیلد :attribute الزامیست مگر این فیلد :other مقدارش :values باشد.', - "required_with" => ":attribute الزامی است زمانی که :values موجود است.", - "required_with_all" => ":attribute الزامی است زمانی که :values موجود است.", - "required_without" => ":attribute الزامی است زمانی که :values موجود نیست.", - "required_without_all" => ":attribute الزامی است زمانی که :values موجود نیست.", - "same" => ":attribute و :other باید مانند هم باشند.", - "size" => [ - "numeric" => ":attribute باید برابر با :size باشد.", - "file" => ":attribute باید برابر با :size کیلوبایت باشد.", - "string" => ":attribute باید برابر با :size کاراکتر باشد.", - "array" => ":attribute باسد شامل :size آیتم باشد.", - ], - 'starts_with' => ':attribute باید با یکی از این مقادیر شروع شود: :values.', - "string" => ":attribute باید رشته باشد.", - "timezone" => "فیلد :attribute باید یک منطقه صحیح باشد.", - "unique" => ":attribute قبلا انتخاب شده است.", - 'uploaded' => 'فیلد :attribute به درستی اپلود نشد.', - "url" => "فرمت آدرس :attribute اشتباه است.", - 'uuid' => ':attribute باید یک فرمت درست UUID باشد.', - - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute.rule" to name the lines. This makes it quick to - | specify a specific custom language line for a given attribute rule. - | - */ - - 'custom' => [], - - /* - |-------------------------------------------------------------------------- - | Custom Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap attribute place-holders - | with something more reader friendly such as E-Mail Address instead - | of "email". This simply helps us make messages a little cleaner. - | - */ - 'attributes' => [ - "name" => "نام", - "username" => "نام کاربری", - "national_code" => "کد ملی", - "email" => "پست الکترونیکی", - "first_name" => "نام", - "last_name" => "نام خانوادگی", - "family" => "نام خانوادگی", - "password" => "رمز عبور", - "password_confirmation" => "تاییدیه ی رمز عبور", - "city" => "شهر", - "country" => "کشور", - "address" => "نشانی", - "phone" => "تلفن", - "mobile" => "تلفن همراه", - "age" => "سن", - "sex" => "جنسیت", - "gender" => "جنسیت", - "day" => "روز", - "month" => "ماه", - "year" => "سال", - "hour" => "ساعت", - "minute" => "دقیقه", - "second" => "ثانیه", - "title" => "عنوان", - "text" => "متن", - "content" => "محتوا", - "description" => "توضیحات", - "excerpt" => "گلچین کردن", - "date" => "تاریخ", - "time" => "زمان", - "available" => "موجود", - "size" => "اندازه", - "file" => "فایل", - "fullname" => "نام کامل", - 'current_password' => 'رمز عبور فعلی', - 'new_password' => 'رمز عبور جدید', - 'degree' => 'مدرک تحصیلی', - 'major' => 'شغل', - 'avatar' => 'آواتار', - 'lat' => 'طول جغرافیایی', - 'lng' => 'عرض جغرافیایی', - 'azmayesh_type_id' => 'نوع آزمایش', - 'request_date' => 'تاریخ درخواست', - 'report_date' => 'تاریخ گزارش', - 'request_number' => 'شماره درخواست', - 'employer' => 'کارفرما', - 'contractor' => 'پیمانکار', - 'work_number' => 'شماره کار', - 'project_name' => 'نام پروژه', - 'consultant' => 'مشاور', - 'applicant' => 'متقاضی', - 'province_id' => 'استان', - 'azmayesh_id' => 'آزمایش', - 'data' => 'داده', - 'fields' => 'فیلد ها', - 'fields.*.name' => 'نام فیلد', - 'fields.*.unit' => 'واحد فیلد', - 'fields.*.type' => 'نوع فیلد', - 'fields.*.option' => 'گزینه های فیلد', - 'cmms_machine_id' => 'کد یکتا ماشین', - 'contract_subitem_id' => 'کد یکتای پروژه', - 'base_price' => 'قیمت پایه', - 'unit' => 'واحد', - 'phone_number'=> 'شماره تلفن', - 'final_description' => 'توضیحات نهایی', - 'point' => 'منطقه' , - 'info_id' => 'دسته بندی' , - 'activity_date' => 'تاریخ فعالیت', - 'activity_time' => 'زمان فعالیت', - 'recognize_picture' => 'عکس بازدید', - 'recognize_picture_second' => 'عکس بازدید', - 'axis_type_id' => 'نوع محور', - 'supervisor_description' => 'توضیحات کارشناس', - 'need_judiciary' => 'دستور قضایی' , - 'operator_description' => 'توضیحات ناظر', - 'judiciary_document' => 'فایل دستور قضایی', - 'action_picture' => 'عکس اقدامات', - 'finish_picture' => 'عکس پایان کار', - 'action_date' => 'زمان فالیت', - 'evidence_picture' => 'تصویر مشاهده شده', - 'deposit_insurance_image' => 'عکس مبلغ بیمه', - 'deposit_insurance_amount' => ' مبلغ بیمه', - 'deposit_daghi_image' => 'عکس مبلغ بیمه', - 'deposit_daghi_amount' => 'مبلغ داغی', - 'is_foreign' => 'ناوگان خارجی', - 'axis_name' => 'نام محور', - 'driver_name' => 'اسم راننده', - 'plaque' => 'پلاک', - 'driver_national_code' => 'کدملی راننده', - 'driver_phone_number' => 'شماره موبایل راننده', - 'accident_type' => 'نوع خسارت', - 'accident_date' => 'تاریخ تصادف', - 'accident_time' => 'زمان تصادف', - 'report_base' => 'گزارش', - 'police_file' => 'تصویر کروکی یا نامه پلیس راه', - 'police_serial' => 'شماره کروکی یا نامه پلیس راه', - 'police_file_date' => 'تاریخ کروکی یا نامه پلیس راه', - 'damage_picture1' => 'عکس تصادف', - 'damage_picture2' => 'عکس تصادف', - 'damage_items' => 'ایتم های خسارت', - 'damage_items.*.value' => 'میزان ایتم های خسارت', - 'damage_items.*.amount' => 'هزینه خسارت', - 'driver_rate' => 'سهم راننده', - 'code' => 'کد', - 'rahdaran' => 'افراد', - 'machines' => 'خودرو', - 'driver' => 'راننده', - 'zone' => 'منطقه', - 'start_date' => 'تاریخ شروع', - 'end_date' => 'تاریخ پایان', - 'end_point' => 'مقصد', - 'area' => 'منطقه عملیاتی', - 'area.type' => 'نوع محدوده' , - 'area.coordinates' => 'مختصات محدوده', - 'category_id' => 'دسته بندی', - 'explanation' => 'توضیحات', - 'requested_machines' => 'ماشین های درخواستی', - 'type' => 'نوع', - 'road_observed_id' => 'کد واکنش سریع', - 'city_id' => 'شهر', - 'expert_description' => 'توضیح کارشناس', - 'need_payment' => 'نیاز به پرداخت', - 'request_id' => 'شناسه درخواست', - 'access_road' => 'راه دسترسی', - 'access_road.type' => 'نوع راه دسترسی', - 'access_road.coordinates' => 'مختصات راه دسترسی', - 'final_area' => 'محدوده نهایی', - 'final_area.type' => 'نوع محدوده نهایی', - 'final_area.coordinates' => 'مختصات محدوده نهایی', - 'final_plan' => 'طرح نهایی', - 'final_plan.type' => 'نوع طرح نهایی', - 'final_plan.coordinate' => 'مختصات طرح نهایی', - 'national_id' => 'کد ملی' , - 'requested_organization' => 'سازمان درخواست‌کننده', - 'plan_group' => 'گروه طرح', - 'plan_title' => 'موضوع طرح', - 'worksheet' => 'شناسه کاربرگ', - 'response_options' => 'گزینه های پاسخ', - 'isic' => 'کد ISIC', - 'primary_area' => 'محدوده اولیه', - 'primary_area.type' => 'نوع محدوده اولیه', - 'primary_area.coordinates' => 'مختصات محدوده اولیه', - 'forbidden_area' => 'محدوده ممنوعه', - 'forbidden_area.type' => 'نوع محدوده محدوده', - 'forbidden_area.coordinates' => 'مختصات محدوده ممنوعه', - 'edarate_ostani_id' => 'اداره استانی', - 'edarate_shahri_id' => ' اداره شهری' - ], -];