2024-08-30 03:31:22 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Rules\ZxcvbnRule;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
use Illuminate\Validation\Rules\Password;
|
|
|
|
|
|
|
|
class UserEditRequest extends AuthorizedRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
|
|
*/
|
|
|
|
public function rules(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'user.last_name' => [ 'string' ],
|
|
|
|
'user.name' => [ 'string' ],
|
|
|
|
'user.middle_name' => [ 'string' ],
|
|
|
|
'user.email' => [ 'email' ],
|
|
|
|
'user.phone' => [ 'string', 'regex:' . User::PHONE_REGEX ],
|
|
|
|
'user' => 'required',
|
2024-08-30 09:37:24 +02:00
|
|
|
'password' => [ Password::min(1)->rules([ new ZxcvbnRule() ]) ],
|
2024-08-30 03:31:22 +02:00
|
|
|
|
|
|
|
'user.email_verified_at' => 'prohibited',
|
|
|
|
'user.created_at' => 'prohibited',
|
|
|
|
'user.updated_at' => 'prohibited',
|
|
|
|
'user.deleted_at' => 'prohibited',
|
|
|
|
'user.id' => 'prohibited',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|