Attribute aliases should replace all instances of field names in validation error messages
For example, when using the same: rule, the message is "The :attribute must be same with :field", which gives us:
The New Password (again) must be same with new_password
Ideally the attribute alias should be used on the new_password field too. The field name often means nothing to the end user especially if they're not readable. So we want this...
The New Password (again) must be same with New Password
If you don't have time to look into this, could you give me a heads up on where the message aliases are filled and i'll work on a PR?
I would like to bump this thread. I facing similar issue. Same class message:
//class
protected $message = "The :attribute must be same with :field";
//my code
$validator = new Validator($this->request);
$rules = [
'password' => 'min:6',
'confirmPassword' => 'required_with:password|same:password',
'email' => 'email',
'confirm_email' => 'same:email',
];
$alias = [
'password' => Func::translate('password'),
'confirmPassword' => Func::translate('confirm_password'),
'email' => Func::translate('email'),
'confirm_email' => Func::translate('confirm_email'),
];
$validator->setValidation($rules,$alias);
try {
$validator->validate();
} catch (ExceptionValidator $e){
return $this->view->renderFail($e->getMessage());
}
now the issue when getting fail translation for "confirm_password" field but the same field that must have same value "password" (:field) is not translated.
has any one got a workaround this issue?