Handle JSON validation errors like 5.4

This commit is contained in:
snipe 2019-05-24 01:12:21 -07:00
parent 96e2d74ae3
commit 84c3709161

View file

@ -65,4 +65,18 @@ class AssetRequest extends Request
\Input::flash();
return parent::response($errors);
}
/**
* Handle a failed validation attempt.
*
* @param \Illuminate\Contracts\Validation\Validator $validator
* @return void
*
* @throws \Illuminate\Validation\ValidationException
*/
protected function failedValidation(Validator $validator)
{
\Log::error('failedValidation');
throw new HttpResponseException(response()->json($validator->errors(), 'error', 422));
}
}