1 | <?php |
||
12 | abstract class JsonApiController extends Controller |
||
13 | { |
||
14 | use JsonApiErrors; |
||
15 | |||
16 | /** |
||
17 | * Return the Eloquent Model for the resource. |
||
18 | * |
||
19 | * @return Model |
||
20 | */ |
||
21 | abstract protected function getModel(); |
||
22 | |||
23 | /** |
||
24 | * Return the type name of the resource. |
||
25 | * |
||
26 | * @return string |
||
27 | */ |
||
28 | protected function getModelType() |
||
32 | |||
33 | /** |
||
34 | * Return a listing of the resource. |
||
35 | * |
||
36 | * @param Request $request |
||
37 | * |
||
38 | * @return JsonApiResponse |
||
39 | */ |
||
40 | public function indexAction(Request $request) |
||
51 | |||
52 | /** |
||
53 | * Return a specified record. |
||
54 | * |
||
55 | * @param Request $request |
||
56 | * @param Model|int $record |
||
57 | * |
||
58 | * @return JsonApiResponse |
||
59 | */ |
||
60 | public function showAction(Request $request, $record) |
||
67 | |||
68 | /** |
||
69 | * Return an instance of the resource by primary key. |
||
70 | * |
||
71 | * @param mixed $key |
||
72 | * |
||
73 | * @throws \Illuminate\Database\Eloquent\ModelNotFoundException |
||
74 | * |
||
75 | * @return Model|JsonApiResponse |
||
76 | */ |
||
77 | protected function findModelInstance($key) |
||
81 | |||
82 | /** |
||
83 | * Transform a model instance into a JSON API object. |
||
84 | * |
||
85 | * @param Model $record |
||
86 | * @param array|null $include Relations to include |
||
87 | * @param array|null $fields Field names of attributes to limit to |
||
88 | * |
||
89 | * @return array |
||
90 | */ |
||
91 | protected function transformRecord($record, array $include = [], array $fields = []) |
||
105 | } |
||
106 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.