Passed
Push — feature/hr-admin-panel ( 021183...5204d3 )
by Grant
17:04 queued 13s
created

Manager::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 13
rs 9.9
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Http\Resources;
4
5
use App\Http\Resources\JobPoster as JobPosterResource;
6
use App\Http\Resources\User as UserResource;
7
use Illuminate\Http\Resources\Json\JsonResource;
8
9
class Manager 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 array_merge(parent::toArray($request), [
20
            'department' => new JsonResource($this->whenLoaded('department')),
21
            'development_opportunity_frequency' => new JsonResource($this->whenLoaded('development_opportunity_frequency')),
22
            'engage_team_frequency' => new JsonResource($this->whenLoaded('engage_team_frequency')),
23
            'job_posters' => JobPosterResource::collection($this->whenLoaded('job_posters')),
24
            'refuse_low_value_work_frequency' => new JsonResource($this->whenLoaded('refuse_low_value_work_frequency')),
25
            'stay_late_frequency' => new JsonResource($this->whenLoaded('stay_late_frequency')),
26
            'team_culture' => new JsonResource($this->whenLoaded('team_culture')),
27
            'user' => new UserResource($this->whenLoaded('user')),
28
            'work_environment' => new JsonResource($this->whenLoaded('work_environment')),
29
            'work_review_frequency' => new JsonResource($this->whenLoaded('work_review_frequency')),
30
        ]);
31
    }
32
}
33