Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
CostCenterResource
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 toArray
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Domain\CostCenter\Resources;
4
5use Domain\Integration\Resources\IntegrationResource;
6
7use Illuminate\Http\Request;
8use Illuminate\Http\Resources\Json\JsonResource;
9
10/**
11 * @property integer $id
12 * @property string $description
13 * @property string $acronym
14 * @property IntegrationResource $integration
15 * @property string $created_at
16 * @property string $updated_at
17 */
18class CostCenterResource extends JsonResource
19{
20
21    public function toArray(Request $request): array
22    {
23        return [
24            'id'          => $this->id,
25            'description' => $this->description,
26            'acronym'     => $this->acronym,
27            'integration' => IntegrationResource::make($this->whenLoaded('integration')),
28            'resource_center' => ResourceCenterResource::collection($this->whenLoaded('resourceCenter')),
29            'created_at'  => $this->created_at,
30            'updated_at'  => $this->updated_at
31        ];
32    }
33}