Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
PurchaseOrderResource
0.00% covered (danger)
0.00%
0 / 7
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 / 7
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Domain\PurchaseOrder\Resources;
4
5use Domain\Integration\Resources\IntegrationResource;
6use Domain\Supplier\Resources\SupplierResource;
7use Illuminate\Http\Request;
8use Illuminate\Http\Resources\Json\JsonResource;
9
10class PurchaseOrderResource extends JsonResource
11{
12    /**
13     * Transform the resource into an array.
14     *
15     * @return array<string, mixed>
16     */
17    public function toArray(Request $request): array
18    {
19        return [
20            'id' => $this->id,
21            'suppliers' => SupplierResource::make($this->whenLoaded('supplier')),
22            'integration' => IntegrationResource::make($this->whenLoaded('integration')),
23            'created_at' => $this->created_at,
24            'updated_at' => $this->updated_at
25        ];
26    }
27}