1 | <?php |
||
8 | trait JsonApiTransforms |
||
9 | { |
||
10 | /** |
||
11 | * Transform a model instance into a JSON API object. |
||
12 | * |
||
13 | * @param \Illuminate\Database\Eloquent\Model $record |
||
14 | * @param array|null $fields Field subset to return |
||
15 | * @param array|null $include Relations to include |
||
16 | * |
||
17 | * @return array |
||
18 | */ |
||
19 | protected function transformRecord($record, array $fields = [], array $include = []) |
||
52 | |||
53 | /** |
||
54 | * Transform a model instance into a JSON API object without additonal data. |
||
55 | * |
||
56 | * @param \Illuminate\Database\Eloquent\Model $record |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | protected function transformRecordSimple($record) |
||
73 | |||
74 | /** |
||
75 | * Transform a set of models into a JSON API collection. |
||
76 | * |
||
77 | * @param \Illuminate\Support\Collection $records |
||
78 | * @param array $fields |
||
79 | * |
||
80 | * @return array |
||
81 | */ |
||
82 | protected function transformCollection($records, array $fields = []) |
||
90 | |||
91 | /** |
||
92 | * Transform a set of models into a JSON API colleciton without additional data. |
||
93 | * |
||
94 | * @param \Illuminate\Support\Collection $records |
||
95 | * |
||
96 | * @return array |
||
97 | */ |
||
98 | protected function transformCollectionSimple($records) |
||
106 | |||
107 | /** |
||
108 | * Transform a set of models into a collection of JSON API resource |
||
109 | * identifier objects. |
||
110 | * |
||
111 | * @param \Illuminate\Support\Collection $records |
||
112 | * |
||
113 | * @return array |
||
114 | */ |
||
115 | protected function transformCollectionIds($records) |
||
126 | } |
||
127 |