mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Handle JSON validation errors like 5.4
This commit is contained in:
parent
96e2d74ae3
commit
84c3709161
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue