Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function toArray(Request $request): array |
||
22 | { |
||
23 | $userId = Auth::user() ? Auth::user()->id : 0; |
||
|
|||
24 | |||
25 | /** @var Comment $this */ |
||
26 | return [ |
||
27 | 'id' => $this->id, |
||
28 | 'website' => $this->website, |
||
29 | 'content' => $this->content, |
||
30 | 'status' => $this->status, |
||
31 | 'author' => AuthorResource::make($this->author), |
||
32 | 'replies' => CommentResource::collection($this->replies), |
||
33 | 'likes_count' => $this->likesCountDigital(), |
||
34 | 'is_liked' => $this->isLikedBy($userId), |
||
35 | ]; |
||
38 |