Testimony::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 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 Testimony 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
            'approved' => (bool) $this->approved,
23
            'user' => new User($this->user),
24
            'date' => Helper::getDates($this->created_at),
25
        ];
26
    }
27
}
28