If I inject the FormRequest into the Controller method, such as:
public function createTask(CreateTaskRequest $request)
{
// ...
}
I can validate all the data inside the CreateTaskRequest as usual using the rules() method. But how can I handle the response myself when the validation fails? There are cases for our API where I want to return an XML response, so I need some sort of way to access the error bag and output all the errors in the XML response.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire