Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
FamilyResource
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 toArray
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Domain\Category\Resources;
4
5use Illuminate\Http\Request;
6use Illuminate\Http\Resources\Json\JsonResource;
7
8use App\Models\Integration\Integration;
9
10/**
11 * @property int $id
12 * @property string $name
13 * @property string $observation
14 * @property int $priority_field
15 * @property int $priority_order
16 * @property Integration $integration
17 * @property int $priority_field
18 * @property int $priority_order
19 */
20class FamilyResource extends JsonResource
21{
22    /**
23     * Transform the resource into an array.
24     *
25     * @param Request $request
26     * @return array
27     */
28    public function toArray(Request $request): array
29    {
30        return [
31            'id'             => $this->id,
32            'name'           => $this->name,
33            'observation'    => $this->observation,
34            'priority_field' => $this->priority_field,
35            'priority_order' => $this->priority_order,
36            'origin'         => OriginResource::make($this->whenLoaded('origin')),
37        ];
38    }
39}