Passed
Push — task/batch-request-skills-step ( d5d8c8...80c6aa )
by Tristan
07:05 queued 02:01
created

Skill   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 5 1
1
<?php
2
3
namespace App\Http\Resources;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
use App\Models\SkillCategory;
7
8
class Skill 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
        $this->load('skill_categories');
19
        return array_merge(parent::toArray($request), [
20
            'skill_categories' => $this->skill_categories->pluck('id')->all()
21
        ]);
22
    }
23
}
24