vendredi 8 mars 2019

Form Request Validation return key

I'm making an app multilanguage and I have the next formRequest:

   public function rules()
    {
        return [
           'size' => ['required','numeric', 'unique:sizes,size']
        ];
    }

When the request fail I receive

{
"message": "The given data was invalid.",
"errors": {
    "size": [
        "size must be numeric."
    ]
}

But I don't want this format, I want

error => user.name.numeric

This format is better to make multilanguage testing



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire