1 | <?php |
||
8 | class TopicTransformer extends BaseTransformer |
||
9 | { |
||
10 | /** |
||
11 | * Resources that can be included if requested. |
||
12 | * |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $availableIncludes = ['user', 'last_reply_user', 'replies', 'node']; |
||
16 | |||
17 | /** |
||
18 | * Include resources without needing it to be requested. |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $defaultIncludes = []; |
||
23 | |||
24 | /** |
||
25 | * Transform the \Topic entity. |
||
26 | * |
||
27 | * @param Topic $model |
||
28 | * |
||
29 | * @return array |
||
30 | */ |
||
31 | public function transformData($model) |
||
32 | { |
||
33 | $data = $model->toArray(); |
||
34 | $data['links'] = [ |
||
35 | 'details_web_view' => route('topic.web_view', $model->id), |
||
36 | 'replies_web_view' => route('replies.web_view', $model->id), |
||
37 | 'web_url' => trim(config('app.url'), '/').'/topics/'.$model->id, |
||
38 | ]; |
||
39 | |||
40 | return $data; |
||
41 | } |
||
42 | |||
43 | public function includeUser($model) |
||
47 | |||
48 | public function includeLastReplyUser($model) |
||
52 | |||
53 | public function includeReplies($model) |
||
57 | |||
58 | public function includeNode($model) |
||
62 | } |
||
63 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: