I have following code in my Request class that returns custom messages.
public function formatErrors(\Illuminate\Contracts\Validation\Validator $validator) {
if($validator->fails()) {
$validator->errors()->add('Message', "Validation failed");
}
return parent::formatErrors($validator);
}
It was returning the error messages in Laravel 5.4 but seems like this function is no more working in Laravel 5.5
Did anybody face this issue in Laravel 5.5?
In Upgrade guide you can read:
So what you should do is add to
app\Exceptions\Handler.php
file the following method:obviously you might want to adjust this method more because in previous Laravel versions it was by default like this: