18 lines
435 B
PHP
18 lines
435 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Requests;
|
||
|
|
||
|
use Illuminate\Contracts\Validation\Validator;
|
||
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
||
|
|
||
|
class RestRequest extends FormRequest
|
||
|
{
|
||
|
protected function failedValidation(Validator $validator)
|
||
|
{
|
||
|
$exception = $validator->getException();
|
||
|
|
||
|
throw new HttpResponseException(response()->json($validator->errors(), 422));
|
||
|
}
|
||
|
}
|