I have an array I want to validate and throw exception with custom messages if validation failed.
I found method withMessages which allows to do what I want, but it doesn't exist in laravel 5.2, so I've tried to something like this:
throw new \Illuminate\Validation\ValidationException($val, Response::create([
'status' => 'error',
'notValidCallactions' => [0]
], 400)
);
This didn't work, validation still throws error, but there is no custom fields in response.
In 'notValidCallactions' will be id's of nodes where validation failed
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire