Reputation: 3234
When using the Validator the error messages contain the localized version of the errors which is nice for displaying on a website. But in my API I want the non localized error messages to be displayed. E.g instead of The :attribute field is required.
I would like required
as the error.
How can I get the non-localized error messages from the validator?
Upvotes: 0
Views: 1214
Reputation: 572
In the Laravel Validation documentation there is a example of this. Take a look at Validating Multiple Fields
topic.
See:
if ($validator->fails())
{
$messages = $validator->messages(); // get the messages
$failed = $validator->failed(); // get the failed rules
}
I hope this helps.
Upvotes: 1