Conditions | 2 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | public function toArray($request) |
||
34 | { |
||
35 | $owner = (clone $this->owner)->unsetRelations(); |
||
36 | |||
37 | return $this |
||
38 | ->collection |
||
39 | ->map(function (CommentResource $resource) use ($request, $owner) { |
||
|
|||
40 | $comment = $resource->resource; |
||
41 | $comment->setRelation('resource', $owner); |
||
42 | |||
43 | foreach ($comment->children as $child) { |
||
44 | $child->setRelation('resource', $owner); |
||
45 | } |
||
46 | |||
47 | return $resource; |
||
48 | }) |
||
49 | ->keyBy('id') |
||
50 | ->toArray(); |
||
51 | } |
||
53 |
This check looks for imports that have been defined, but are not used in the scope.