TestimonyDetails   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 3
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 14 1
1
<?php
2
3
namespace Faithgen\Testimonies\Http\Resources;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
use InnoFlash\LaraStart\Helper;
7
8
class TestimonyDetails extends JsonResource
9
{
10
    /**
11
     * Transform the resource into an array.
12
     *
13
     * @param \Illuminate\Http\Request $request
14
     * @return array
15
     */
16
    public function toArray($request)
17
    {
18
        return [
19
            'id' => $this->id,
20
            'title' => $this->title,
21
            'comments_count' => $this->comments()->count(),
22
            'resource' => $this->resource->resource,
23
            'testimony' => $this->testimony,
24
            'approved' => (bool) $this->approved,
25
            'user' => $this->user,
26
            'date' => Helper::getDates($this->created_at),
27
            'images' => Image::collection($this->images),
28
        ];
29
    }
30
}
31