Issues (42)

src/Http/Resources/Sermon.php (9 issues)

1
<?php
2
3
namespace FaithGen\Sermons\Http\Resources;
4
5
use Carbon\Carbon;
6
use FaithGen\SDK\Helpers\ImageHelper;
7
use Illuminate\Http\Resources\Json\JsonResource;
8
use InnoFlash\LaraStart\Helper;
9
10
class Sermon extends JsonResource
11
{
12
    /**
13
     * Transform the resource into an array.
14
     *
15
     * @param \Illuminate\Http\Request $request
16
     * @return array
17
     */
18
    public function toArray($request)
19
    {
20
        return [
21
            'id' => $this->id,
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on FaithGen\Sermons\Http\Resources\Sermon. Since you implemented __get, consider adding a @property annotation.
Loading history...
22
            'title' => $this->title,
0 ignored issues
show
Bug Best Practice introduced by
The property title does not exist on FaithGen\Sermons\Http\Resources\Sermon. 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\Sermons\Http\Resources\Sermon. 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
            'comments' => [
25
                'count' => number_format($this->comments()->count()),
26
            ],
27
            'preacher' => [
28
                'name' => $this->preacher,
0 ignored issues
show
Bug Best Practice introduced by
The property preacher does not exist on FaithGen\Sermons\Http\Resources\Sermon. Since you implemented __get, consider adding a @property annotation.
Loading history...
29
                'avatar' => ImageHelper::getImage('sermons', $this->image, config('faithgen-sdk.ministries-server')),
0 ignored issues
show
Bug Best Practice introduced by
The property image does not exist on FaithGen\Sermons\Http\Resources\Sermon. Since you implemented __get, consider adding a @property annotation.
Loading history...
30
            ],
31
            'date' => Helper::getDates(Carbon::parse($this->date)),
0 ignored issues
show
Bug Best Practice introduced by
The property date does not exist on FaithGen\Sermons\Http\Resources\Sermon. Since you implemented __get, consider adding a @property annotation.
Loading history...
32
            'resource' => $this['resource'],
33
            'verses' => [
34
                'main' => $this->main_verses,
0 ignored issues
show
Bug Best Practice introduced by
The property main_verses does not exist on FaithGen\Sermons\Http\Resources\Sermon. Since you implemented __get, consider adding a @property annotation.
Loading history...
35
                'reference' => $this->reference_verses,
0 ignored issues
show
Bug Best Practice introduced by
The property reference_verses does not exist on FaithGen\Sermons\Http\Resources\Sermon. Since you implemented __get, consider adding a @property annotation.
Loading history...
36
            ],
37
            'sermon' => $this->sermon,
0 ignored issues
show
Bug Best Practice introduced by
The property sermon does not exist on FaithGen\Sermons\Http\Resources\Sermon. Since you implemented __get, consider adding a @property annotation.
Loading history...
38
        ];
39
    }
40
}
41