1 | <?php |
||||
2 | |||||
3 | namespace FaithGen\Messages\Http\Resources; |
||||
4 | |||||
5 | use Illuminate\Http\Resources\Json\JsonResource; |
||||
6 | use InnoFlash\LaraStart\Helper; |
||||
7 | |||||
8 | class Message extends JsonResource |
||||
9 | { |
||||
10 | /** |
||||
11 | * Transform the resource into an array. |
||||
12 | * |
||||
13 | * @param \Illuminate\Http\Request $request |
||||
14 | * @return array |
||||
15 | */ |
||||
16 | public function toArray($request) |
||||
17 | { |
||||
18 | return [ |
||||
19 | 'id' => $this->id, |
||||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||||
20 | 'title' => $this->title, |
||||
0 ignored issues
–
show
The property
title does not exist on FaithGen\Messages\Http\Resources\Message . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
21 | 'message' => $this->message, |
||||
0 ignored issues
–
show
The property
message does not exist on FaithGen\Messages\Http\Resources\Message . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
22 | 'date' => Helper::getDates($this->created_at), |
||||
0 ignored issues
–
show
The property
created_at does not exist on FaithGen\Messages\Http\Resources\Message . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
23 | 'comments' => [ |
||||
24 | 'count' => number_format($this->comments()->count()), |
||||
0 ignored issues
–
show
The method
comments() does not exist on FaithGen\Messages\Http\Resources\Message . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
25 | ], |
||||
26 | ]; |
||||
27 | } |
||||
28 | } |
||||
29 |