Issues (33)

src/Http/Resources/Album.php (6 issues)

1
<?php
2
3
namespace FaithGen\Gallery\Http\Resources;
4
5
use FaithGen\SDK\Helpers\ImageHelper;
6
use Illuminate\Http\Resources\Json\JsonResource;
7
use InnoFlash\LaraStart\Helper;
8
9
class Album extends JsonResource
10
{
11
    /**
12
     * Transform the resource into an array.
13
     *
14
     * @param \Illuminate\Http\Request $request
15
     * @return array
16
     */
17
    public function toArray($request)
18
    {
19
        return [
20
            'id' => $this->id,
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on FaithGen\Gallery\Http\Resources\Album. Since you implemented __get, consider adding a @property annotation.
Loading history...
21
            'name' => $this->name,
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist on FaithGen\Gallery\Http\Resources\Album. Since you implemented __get, consider adding a @property annotation.
Loading history...
22
            'description' => $this->description,
0 ignored issues
show
Bug Best Practice introduced by
The property description does not exist on FaithGen\Gallery\Http\Resources\Album. Since you implemented __get, consider adding a @property annotation.
Loading history...
23
            'comments' => $this->comments()->count(),
0 ignored issues
show
The method comments() does not exist on FaithGen\Gallery\Http\Resources\Album. 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

23
            'comments' => $this->/** @scrutinizer ignore-call */ comments()->count(),
Loading history...
24
            'date' => Helper::getDates($this->created_at),
0 ignored issues
show
Bug Best Practice introduced by
The property created_at does not exist on FaithGen\Gallery\Http\Resources\Album. Since you implemented __get, consider adding a @property annotation.
Loading history...
25
            'images' => [
26
                'count' => $this->images()->count(),
0 ignored issues
show
The method images() does not exist on FaithGen\Gallery\Http\Resources\Album. 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

26
                'count' => $this->/** @scrutinizer ignore-call */ images()->count(),
Loading history...
27
            ],
28
            'avatar' => ImageHelper::getImage('gallery', $this->images()->latest()->first(), config('faithgen-sdk.ministries-server')),
29
        ];
30
    }
31
}
32