How i can return a customized response in a FormRequest class in Laravel 5.5?
问题 I am making an API and i want return the array of errors with a format as the one that $validator->errors(); generates when i validate the request by the manual way. But i cant manipulate the response. I wanna find thhe correct way to make it. This could be done in Laravel 5.4 with the formatErrors method and including the Illuminate\Contracts\Validation\Validator class in the FormRequest class but for version 5.5 it does not work. I do not know how to do it. This is my Controller: <?php