Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| CustomerResource | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| toArray | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\Customer\Resources; |
| 4 | |
| 5 | use App\Models\Integration\Integration; |
| 6 | use Domain\Customer\Enums\CustomerStatusEnum; |
| 7 | use Domain\Shared\Enums\SectorEnum; |
| 8 | use Domain\Team\Resources\TeamResource; |
| 9 | use Illuminate\Http\Request; |
| 10 | use 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 | */ |
| 21 | class 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 | } |