Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
PurchaseOrderSeniorResource
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
12
0.00% covered (danger)
0.00%
0 / 1
 toArray
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3namespace Domain\PurchaseOrder\Resources;
4
5use Illuminate\Http\Request;
6use Illuminate\Http\Resources\Json\JsonResource;
7
8class PurchaseOrderSeniorResource extends JsonResource
9{
10    /**
11     * Transform the resource into an array.
12     *
13     * @return array<string, mixed>
14     */
15    public function toArray(Request $request): array
16    {
17        $itens = null;
18        if(isset($this->itens))
19        {
20            $itens = PurchaseOrderItemSeniorResource::collection(collect(is_array($this->itens) ? $this->itens : [$this->itens]));
21        }
22
23        return [
24            'cgcCpf' => $this->cgcCpf,
25            'codEmp' => $this->codEmp,
26            'codFil' => $this->codFil,
27            'codFor' => $this->codFor,
28            'codGre' => $this->codGre,
29            'datEmi' => $this->datEmi,
30            'datGer' => $this->datGer,
31            'nomFor' => $this->nomFor,
32            'numOcp' => $this->numOcp,
33            'obsOcp' => $this->obsOcp,
34            'itens' => $itens
35        ];
36    }
37}