Файловый менеджер - Редактировать - /home/clickysoft/public_html/somni.clickysoft.net/app/Http/Requests/Landlord/ChangePasswordRequest.php
Назад
<?php namespace App\Http\Requests\Landlord; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Hash; use App\Rules\PasswordValidation; // Import your custom PasswordValidation rule class ChangePasswordRequest extends FormRequest { /** * Determine if the user is authorized to make this request. */ public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. * * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string> */ public function rules(): array { return [ 'old_password' => [ 'required', function ($attribute, $value, $fail) { if (!Hash::check($value, auth()->user()->password)) { $fail('The old password is incorrect.'); } }, ], 'password' => [ 'required', 'confirmed', new PasswordValidation, // Use the custom PasswordValidation rule ], ]; } /** * Get the error messages for the defined validation rules. * * @return array */ public function messages() { return [ 'old_password.required' => 'The :attribute is required', 'password.required' => 'The :attribute is required', 'password.min' => 'The :attribute should have at least 8 characters', 'password.confirmed' => 'The :attribute confirmation does not match.', ]; } /** * Get custom attributes for validator errors. * * @return array */ public function attributes() { return [ 'password' => 'New Password', 'old_password' => 'Old Password', ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка