According to the docs, error messages can be customized inside lang/en/validation.php but the error message I am receiving is not present in the file:
The password confirmation does not match.
I receive the error message when failing validation because $request->password_confirmation is different from the$request->password:
$request->validate([
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
How can I customize the error message?
CodePudding user response:
$rules = [
'password' => ['required', 'confirmed', Rules\Password::defaults()]
];
$customMessages = [
'password.confirmed' => 'The :attribute does not match' // change it at here
];
$this->validate($request, $rules, $customMessages);
Rule confirmed The field under validation must have a matching
field of {field}_confirmation.
For example, if the field under validation is password,
a matching password_confirmation field must be present in the input.
