Created a FormRequest named ValidationRegister to slightly change the standard registration controller. Since I saw most of the checks in the Request.
Here is the validation itself:
public function rules()
{
return [
'name' => ['required', 'string', 'max:255'],
'surname' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
'gender' => ['nullable', 'string', 'max:10'],
'birthday' => ['nullable', 'string'],
'rules' => 'accepted',
];
}
The essence of the question is how to replace the validation in the controller
Standard validation:
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
There were various attempts to do this, even reached the change of registration trait