TestimonialResource   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 21
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 13 1
1
<?php
2
3
namespace App\Http\Resources;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
7
class TestimonialResource extends JsonResource
8
{
9
    /**
10
     * Transform the resource into an array.
11
     *
12
     * @param  \Illuminate\Http\Request $request
13
     * @return array
14
     */
15
    public function toArray($request)
16
    {
17
        return [
18
            'id'                 => $this->resource->hashed_id,
19
            'avatar'             => $this->resource->avatar,
20
            'avatarThumb'        => $this->resource->avatar_thumb,
21
            'name'               => $this->resource->name,
22
            'position'           => $this->resource->position,
23
            'email'              => $this->resource->email,
24
            'body'               => $this->resource->body,
25
            'stars'              => $this->resource->stars,
26
            'createdAt'          => $this->resource->created_at,
27
            'createdAtForHumans' => $this->resource->created_at->diffForHumans(),
28
        ];
29
    }
30
}
31