faithgen /
laravel-sdk
| 1 | <?php |
||
| 2 | |||
| 3 | namespace FaithGen\SDK\Http\Resources; |
||
| 4 | |||
| 5 | use FaithGen\SDK\Helpers\ImageHelper; |
||
| 6 | use Illuminate\Http\Resources\Json\JsonResource; |
||
| 7 | use Illuminate\Support\Str; |
||
| 8 | use InnoFlash\LaraStart\Helper; |
||
| 9 | |||
| 10 | class Comment extends JsonResource |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Transform the resource into an array. |
||
| 14 | * |
||
| 15 | * @param \Illuminate\Http\Request $request |
||
| 16 | * |
||
| 17 | * @return array |
||
| 18 | */ |
||
| 19 | public function toArray($request) |
||
| 20 | { |
||
| 21 | if ($is_admin = Str::of($this->creatable_type)->contains('Ministry')) { |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 22 | $avatar = ImageHelper::getImage('profile', $this->creatable->image, config('faithgen-sdk.ministries-server')); |
||
|
0 ignored issues
–
show
The property
creatable does not exist on FaithGen\SDK\Http\Resources\Comment. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 23 | } else { |
||
| 24 | $avatar = ImageHelper::getImage('users', $this->creatable->image, config('faithgen-sdk.users-server')); |
||
| 25 | } |
||
| 26 | |||
| 27 | return [ |
||
| 28 | 'id' => $this->id, |
||
|
0 ignored issues
–
show
The property
id does not exist on FaithGen\SDK\Http\Resources\Comment. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 29 | 'comment' => $this->comment, |
||
|
0 ignored issues
–
show
The property
comment does not exist on FaithGen\SDK\Http\Resources\Comment. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 30 | 'creator' => [ |
||
| 31 | 'id' => $this->creatable->id, |
||
| 32 | 'name' => $this->creatable->name, |
||
| 33 | 'is_admin' => $is_admin, |
||
| 34 | 'avatar' => $avatar, |
||
| 35 | ], |
||
| 36 | 'date' => Helper::getDates($this->created_at), |
||
|
0 ignored issues
–
show
The property
created_at does not exist on FaithGen\SDK\Http\Resources\Comment. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 37 | ]; |
||
| 38 | } |
||
| 39 | } |
||
| 40 |