vendredi 27 septembre 2019

Modify unique attribute validation in Laravel

Trying to customize the error message for unique attribute. Tried changing my validation.php.

    'custom' => [
        'email' => [
            'unique:users' => 'Oops, email is taken. Please try again!'
        ]
    ],

and I call the validation in controller:

    request()->validate([
        'email' => 'unique:users',
        'password' => 'required|min:3',
    ]);

And I still get this:

The email has already been taken.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire