Closed abbluiz closed 1 year ago
Heya, thanks for reporting.
We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here? Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.
laravel new bug-report --github="--public"
Please do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.
Thanks!
Closing until a repo is provided.
Description:
Even though I'm passing this as the message in my custom validation rule:
Which translates to
The document CPF already exists in our database.
(I checked in xdebug, it actually returns the correct message).However, after the
$fail()
callback finishes executing, Laravel's validator somehow overrides this with another rule message, which isvalidation.cpf
. Given that "cpf" is the value of$attribute
in this case, it's usingvalidation.${attribute}
as the message key even though I specified something else via$fail()
callback.Steps To Reproduce:
validation.${attribute}
passed as custom message keys (or stored in your translation files);validation.${attribute}
instead of the one you passed in$fail()
This problem DID NOT occur in Laravel 9.19.0