1 | <?php |
||
12 | trait JsonApiTransforms |
||
13 | { |
||
14 | /** |
||
15 | * Transform a model instance into a JSON API object. |
||
16 | * |
||
17 | * @param Model $record |
||
18 | * @param array|null $fields Field subset to return |
||
19 | * @param array|null $include Relations to include |
||
20 | * |
||
21 | * @return array |
||
22 | */ |
||
23 | protected function transformRecord($record, array $fields = [], array $include = []) |
||
60 | |||
61 | /** |
||
62 | * Transform a model instance into a JSON API object without additonal data. |
||
63 | * |
||
64 | * @param Model $record |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | protected function transformRecordSimple($record) |
||
81 | |||
82 | /** |
||
83 | * Transform a model instance into a JSON API resource identifier. |
||
84 | * |
||
85 | * @param Model $record |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | protected function transformRecordIdentifier($record) |
||
98 | |||
99 | /** |
||
100 | * Transform a set of models into a JSON API collection. |
||
101 | * |
||
102 | * @param Collection|LengthAwarePaginator $records |
||
103 | * @param array $fields |
||
104 | * |
||
105 | * @return array |
||
106 | */ |
||
107 | protected function transformCollection($records, array $fields = []) |
||
124 | |||
125 | /** |
||
126 | * Transform a set of models into a JSON API collection without additional data. |
||
127 | * |
||
128 | * @param Collection $records |
||
129 | * |
||
130 | * @return array |
||
131 | */ |
||
132 | protected function transformCollectionSimple($records) |
||
140 | |||
141 | /** |
||
142 | * Transform a set of models into a collection of JSON API resource |
||
143 | * identifier objects. |
||
144 | * |
||
145 | * @param Collection $records |
||
146 | * |
||
147 | * @return array |
||
148 | */ |
||
149 | protected function transformCollectionIdentifiers($records) |
||
157 | |||
158 | /** |
||
159 | * Transform a model relationship into a single, or collection of, JSON API |
||
160 | * resource identifier objects. |
||
161 | * |
||
162 | * @param Model $record |
||
163 | * @param string $relation |
||
164 | * |
||
165 | * @return array |
||
166 | */ |
||
167 | protected function transformRelationship($record, $relation) |
||
179 | } |
||
180 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.