Issues (16)

src/Http/Resources/Message.php (5 issues)

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
The property id does not exist on FaithGen\Messages\Http\Resources\Message. Since you implemented __get, consider adding a @property annotation.
Loading history...
20
            'title' => $this->title,
0 ignored issues
show
Bug Best Practice introduced by
The property title does not exist on FaithGen\Messages\Http\Resources\Message. Since you implemented __get, consider adding a @property annotation.
Loading history...
21
            'message' => $this->message,
0 ignored issues
show
Bug Best Practice introduced by
The property message does not exist on FaithGen\Messages\Http\Resources\Message. Since you implemented __get, consider adding a @property annotation.
Loading history...
22
            'date' => Helper::getDates($this->created_at),
0 ignored issues
show
Bug Best Practice introduced by
The property created_at does not exist on FaithGen\Messages\Http\Resources\Message. Since you implemented __get, consider adding a @property annotation.
Loading history...
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 ignore-call  annotation

24
                'count' => number_format($this->/** @scrutinizer ignore-call */ comments()->count()),
Loading history...
25
            ],
26
        ];
27
    }
28
}
29