77 lines
2.1 KiB
PHP
77 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
|
use App\Repos\System\Settings\Legal\PassportRepo;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class UpdateUserProfileRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
/**
|
|
* Phone number to authenticate
|
|
*
|
|
* @example Mahmyt Allaberdiyev
|
|
*/
|
|
'name' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Phone number to authenticate
|
|
*
|
|
* @example 65707012
|
|
*/
|
|
'phone' => [
|
|
'required',
|
|
'int',
|
|
'between:61000000,71999999',
|
|
Rule::unique('users', 'phone')->ignore(auth()->id()),
|
|
],
|
|
|
|
/**
|
|
* Password (leave empty to save it same)
|
|
*
|
|
* @example MyFcpassword
|
|
*/
|
|
'password' => ['nullable', 'string'],
|
|
|
|
/**
|
|
* Passport serie
|
|
*
|
|
* @example I-AS
|
|
*/
|
|
'passport_serie' => ['sometimes', 'string', Rule::in(array_keys(PassportRepo::values()))],
|
|
|
|
/**
|
|
* Passport id
|
|
*
|
|
* @example 100999
|
|
*/
|
|
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
|
|
|
/**
|
|
* @example 9934612100000543
|
|
*/
|
|
'card_number' => ['sometimes', 'digits:16'],
|
|
|
|
/**
|
|
* @example 12
|
|
*/
|
|
'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
|
|
|
/**
|
|
* @example 2049
|
|
*/
|
|
'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
|
];
|
|
}
|
|
}
|