blob: 0183bb49c4352c75c37667e079babaf3a1c8bb02 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<?php
namespace Infrastructure\Http;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
abstract class ApiRequest extends FormRequest
{
protected function failedValidation(Validator $validator)
{
throw new UnprocessableEntityHttpException($validator->errors()->toJson());
}
protected function failedAuthorization()
{
throw new HttpException(403);
}
}
|