-
After upgraidng the app from Laravel 6 -> 9, I see that the validation error message in 422 API response has been changed. Before:
After:
How can I get the old one back ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
It was changed on 1e02bc2 framework/tests/Validation/ValidationValidatorTest.php Lines 736 to 750 in c8c541c |
Beta Was this translation helpful? Give feedback.
-
I actually found later after my post here, but didn't shared then. Thought I should. So to change the message, add/override below method in the
Also, I recently made a pull request which allows to use custom validation exception class in form requests. Set to, add this to AppServiceProvider.
|
Beta Was this translation helpful? Give feedback.
It was changed on 1e02bc2
For get old one back you have to create a class extending
\Illuminate\Validation\ValidationException
and overwrite the new code with the old oneand set that new custom class on validator with
->setException(CustomValidationException::class)
framework/tests/Validation/ValidationValidatorTest.php
Lines 736 to 750 in c8c541c