1 | <?php |
||
13 | class Request |
||
14 | { |
||
15 | /** @var array */ |
||
16 | protected $json; |
||
17 | |||
18 | /** @var IlluminateRequest */ |
||
19 | protected $request; |
||
20 | |||
21 | /** @var Validator */ |
||
22 | protected $validator; |
||
23 | |||
24 | public function __construct(IlluminateRequest $request) |
||
28 | |||
29 | /** |
||
30 | * @throws RequestFailedValidation |
||
31 | */ |
||
32 | public function validate() |
||
41 | |||
42 | /** |
||
43 | * Ensure that a requested operation is authorized. |
||
44 | * If not, throw an exception. |
||
45 | * |
||
46 | * This requires a registered Policy. |
||
47 | * If no policy is defined, |
||
48 | * the framework will throw InvalidArgumentException. |
||
49 | * |
||
50 | * See also: |
||
51 | * https://laravel.com/docs/master/authorization |
||
52 | * http://jsonapi.org/format/#errors |
||
53 | * |
||
54 | * @param string $action Desired action; must match a policy method name. |
||
55 | * @param mixed $object Target object; class must match a policy. |
||
56 | * @param array $source Reference to source of error in request. |
||
57 | * |
||
58 | * @return bool True on success; throws exception on failure. |
||
59 | * |
||
60 | * @throws RequestFailedAuthorization |
||
61 | * |
||
62 | * TODO: use a UUID for the source? |
||
63 | */ |
||
64 | public function authorize( |
||
83 | |||
84 | public function json(): array |
||
103 | |||
104 | public function validator() : ValidatesRequests |
||
108 | |||
109 | public function setValidator(ValidatesRequests $validator) |
||
113 | |||
114 | public function request(): IlluminateRequest |
||
118 | } |
||
119 |