Cześć mam metodę update w moim api controlerze:
/**
* update action
*
* @param Request $request
* @param integer $id
*
* @return void
*/
public function update(PersonRequest $request, int $id): JsonResponse
{
//jak zlapac bledy ???
Stworzyłem customowy request do walidacji
class PersonRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|string|min:3|max:32'
];
}
}
Jak złapać błędy z takiego requstu ? Bo chciałbym je wyłapać i zwrócić jsona z nimi.