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
![]() |
|||||
22 | 'title' => $this->title, |
||||
0 ignored issues
–
show
The property
title does not exist on FaithGen\Sermons\Http\Resources\Sermon . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
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
![]() |
|||||
24 | 'comments' => [ |
||||
25 | 'count' => number_format($this->comments()->count()), |
||||
26 | ], |
||||
27 | 'preacher' => [ |
||||
28 | 'name' => $this->preacher, |
||||
0 ignored issues
–
show
The property
preacher does not exist on FaithGen\Sermons\Http\Resources\Sermon . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
29 | 'avatar' => ImageHelper::getImage('sermons', $this->image, config('faithgen-sdk.ministries-server')), |
||||
0 ignored issues
–
show
The property
image does not exist on FaithGen\Sermons\Http\Resources\Sermon . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
30 | ], |
||||
31 | 'date' => Helper::getDates(Carbon::parse($this->date)), |
||||
0 ignored issues
–
show
The property
date does not exist on FaithGen\Sermons\Http\Resources\Sermon . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
32 | 'resource' => $this['resource'], |
||||
33 | 'verses' => [ |
||||
34 | 'main' => $this->main_verses, |
||||
0 ignored issues
–
show
The property
main_verses does not exist on FaithGen\Sermons\Http\Resources\Sermon . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
35 | 'reference' => $this->reference_verses, |
||||
0 ignored issues
–
show
The property
reference_verses does not exist on FaithGen\Sermons\Http\Resources\Sermon . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
36 | ], |
||||
37 | 'sermon' => $this->sermon, |
||||
0 ignored issues
–
show
The property
sermon does not exist on FaithGen\Sermons\Http\Resources\Sermon . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||
38 | ]; |
||||
39 | } |
||||
40 | } |
||||
41 |