Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
PickedItemResource
0.00% covered (danger)
0.00%
0 / 8
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 / 8
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace Domain\PickingOrder\Resources;
4
5use Illuminate\Http\Request;
6use Illuminate\Http\Resources\Json\JsonResource;
7
8use Domain\Item\Resource\ItemResource;
9use Domain\StockIO\Resources\StockIOProductResource;
10use Domain\ShippingPackaging\Resources\ShippingPackagingProductResource;
11
12/**
13 * @property float $amount
14 * @property int $id
15 * @property string $observation
16 */
17class PickedItemResource extends JsonResource
18{
19    /**
20     * @param Request $request
21     * @return array
22     */
23    public function toArray(Request $request): array
24    {
25        return [
26            'id' => $this->id,
27            'amount' => $this->amount,
28            'item' => ItemResource::make($this->whenLoaded('item')),
29            'stock_io_product' => StockIOProductResource::make($this->whenLoaded('stockIOProduct')),
30            'shipping_packaging_products' => ShippingPackagingProductResource::collection($this->whenLoaded('shippingPackagingProducts')),
31            'observation' => $this->observation,
32        ];
33    }
34}