33 lines
960 B
PHP
33 lines
960 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api\Client;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ClientChangePasswordRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return auth('client')->check();
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'current_password' => 'required|string',
|
|
'password' => 'required|string|min:8|confirmed|different:current_password',
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'current_password.required' => 'Mật khẩu hiện tại là bắt buộc',
|
|
'password.required' => 'Mật khẩu mới là bắt buộc',
|
|
'password.min' => 'Mật khẩu mới phải có ít nhất 8 ký tự',
|
|
'password.confirmed' => 'Xác nhận mật khẩu không khớp',
|
|
'password.different' => 'Mật khẩu mới phải khác mật khẩu hiện tại',
|
|
];
|
|
}
|
|
}
|