Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
CustomerResource
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 toArray
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Domain\Customer\Resources;
4
5use App\Models\Integration\Integration;
6use Domain\Customer\Enums\CustomerStatusEnum;
7use Domain\Shared\Enums\SectorEnum;
8use Domain\Team\Resources\TeamResource;
9use Illuminate\Http\Request;
10use Illuminate\Http\Resources\Json\JsonResource;
11
12/**
13 * @property string $description
14 * @property Integration $integration
15 * @property CustomerStatusEnum $status
16 * @property string $created_at
17 * @property string $updated_at
18 * @property string $deleted_at
19 * @property int $id
20 */
21class CustomerResource extends JsonResource
22{
23
24    public function toArray(Request $request): array
25    {
26        return [
27            'id' => $this->id,
28            'description' => $this->description,
29            'status' => $this->status->value,
30            'integration' => $this->whenLoaded('integration', fn() => $this->integration->parameters),
31            'team' => TeamResource::make($this->whenLoaded('team')),
32            'created_at' => (string)$this->created_at,
33            'updated_at' => (string)$this->updated_at,
34            'deleted_at' => (string)$this->deleted_at
35        ];
36    }
37}