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