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
PackagingResource
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\Packaging\Resources;
4
5use Domain\Integration\Resources\IntegrationResource;
6use Domain\Packaging\Enums\PackagingTypeEnum;
7use Illuminate\Http\Request;
8use Illuminate\Http\Resources\Json\JsonResource;
9
10/**
11 * @property int $id
12 * @property string $description
13 * @property PackagingTypeEnum $type
14 * @property string $created_at
15 * @property string $updated_at
16 */
17class PackagingResource extends JsonResource
18{
19    public function toArray(Request $request): array
20    {
21        return [
22            'id' => $this->id,
23            'description' => $this->description,
24            'type' => $this->type->value,
25            'integration' => IntegrationResource::make($this->whenLoaded('integration')),
26            'created_at' => (string)$this->created_at,
27            'updated_at' => (string)$this->updated_at,
28        ];
29    }
30}