vendredi 10 février 2017

Laravel custom validation message

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?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kayp22
via IFTTT

Aucun commentaire:

Enregistrer un commentaire