UserPasswordRequest

2
Правила валидации с использованием класса для валидации паролей
app/Http/Requests/UserPasswordRequest.php
                            
<?php
 
namespace App\Http\Requests;
 
use Illuminate\Foundation\Http\FormRequest as HttpFormRequest;
use Illuminate\Validation\Rules\Password;
 
class UserPasswordRequest extends HttpFormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return auth()->check();
}
 
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
"password" => [Password::min(8)->letters()->mixedCase()->numbers()->symbols()->uncompromised()],
];
}
}