Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| RequestDevolutionResource | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| toArray | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\Request\Resources; |
| 4 | |
| 5 | use Domain\StockIO\Resources\StockIOProductResource; |
| 6 | use Illuminate\Http\Request; |
| 7 | use Illuminate\Http\Resources\Json\JsonResource; |
| 8 | |
| 9 | use Domain\Integration\Resources\IntegrationResource; |
| 10 | |
| 11 | /** |
| 12 | * @property int $id |
| 13 | * @property float $amount |
| 14 | * @property string $created_at |
| 15 | * @property string $updated_at |
| 16 | */ |
| 17 | class RequestDevolutionResource extends JsonResource |
| 18 | { |
| 19 | |
| 20 | public function toArray(Request $request): array |
| 21 | { |
| 22 | return [ |
| 23 | 'id' => $this->id, |
| 24 | 'applicant' => $this->applicant, |
| 25 | 'stock_io_product' => StockIOProductResource::make($this->whenLoaded('stockIOProduct')), |
| 26 | 'stock_io_product_id' => $this->stock_io_product_id, |
| 27 | 'integration' => IntegrationResource::make($this->whenLoaded('integration')), |
| 28 | 'amount' => $this->amount, |
| 29 | 'observation' => $this->observation, |
| 30 | 'created_at' => (string)$this->created_at, |
| 31 | 'updated_at' => (string)$this->updated_at, |
| 32 | ]; |
| 33 | } |
| 34 | } |