I'm using laravel 5.4 to make a custom form validation. But why is the custom error message isn't displayed?
Validator::extend('myCustomeValidator', function ($attribute, $value, $parameters, $validator) {
//some code here
return false;
});
return Validator::make($data, [
'myField' => 'myCustomeValidator',
]);
and added the following to the file : ressources\lang\en\validation.php as the documentation advises:
'custom' => [
'myField' => [
'myCustomeValidator' => 'You made an error.',
],
],
The error is correctly triggered but instead of my custom error message, I get this:
validation.my_custome_validator
What am I missing?
Name of the validation rule cannot contain capital letters but can be snake_cased. Like so:
'custom' => [
'myField' => [
'my_custome_validator' => 'You made an error.',
],
],
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community