jeudi 25 février 2016

Customized Error Message : Laravel 5.2.15

I have the following code written in Request class under Rules method.

public function rules()
{
    return [
        'Currency' => 'required|max:5|min:2|composite_unique:tblcurrency,CurrencyCode',
        'CurrencyCode' => 'required|max:5|min:1',
    ];
}

This works fine. Only issue is, when the validation fails, I get the following message..

validation.composite_unique

What i tried so far?

After writing the below code, still I am getting the same error string.

public function messages () {
    return [
        'validation.composite_unique'  => 'Duplicate Country and code combination found.',
    ];
}

Question: Can we customize the error message to make it look more user friendly?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire