Passed
Push — dev5 ( 6e89ff...3685b3 )
by Ron
05:58
created

TechTips::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 9
ccs 0
cts 6
cp 0
crap 2
rs 10
1
<?php
2
3
namespace App\Http\Resources;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
use Illuminate\Support\Str;
7
use Carbon\Carbon;
8
9
class TechTips 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 parent::toArray($request);
20
        return [
21
            'tip_id'       => $this->tip_id,
22
            'subject'      => $this->subject,
23
            'description'  => Str::words($this->description, 50),
24
            'created_at'   => Carbon::parse($this->created_at)->format('M d, Y'),
25
            'system_types' => $this->SystemTypes,
26
        ];
27
    }
28
}
29