Image::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Faithgen\Testimonies\Http\Resources;
4
5
use FaithGen\SDK\Helpers\ImageHelper;
6
use Illuminate\Http\Resources\Json\JsonResource;
7
use InnoFlash\LaraStart\Helper;
8
9
class Image 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,
21
            'caption' => $this->caption,
22
            'comments_count' => $this->comments()->count(),
23
            'date' => Helper::getDates($this->created_at),
24
            'avatar' => ImageHelper::getImage('testimonies', $this->resource, config('faithgen-sdk.ministries-server')),
25
        ];
26
    }
27
}
28