You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
631 B
25 lines
631 B
<?php
|
|
|
|
namespace App\Http\Requests\Api;
|
|
|
|
use Illuminate\Contracts\Validation\Validator;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
|
|
|
abstract class ApiRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Handle a failed validation attempt.
|
|
*
|
|
* @return void
|
|
*
|
|
* @throws HttpResponseException
|
|
*/
|
|
protected function failedValidation(Validator $validator)
|
|
{
|
|
throw new HttpResponseException(response()->json([
|
|
'message' => trans('ui.crud.error.validation_failed'),
|
|
'errors' => $validator->errors(),
|
|
], 422));
|
|
}
|
|
}
|
|
|