Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| ShippingPackagingResource | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| toArray | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Domain\ShippingPackaging\Resources; |
| 4 | |
| 5 | use App\Models\ShippingPackaging\ShippingPackaging; |
| 6 | use App\Models\ShippingPackaging\ShippingPackagingProduct; |
| 7 | use Domain\Integration\Resources\IntegrationResource; |
| 8 | use Domain\Packaging\Resources\PackagingResource; |
| 9 | use Domain\StockIO\Resources\StockOIResource; |
| 10 | use Domain\ShippingPackaging\Enums\ShippingPackagingStatusEnum; |
| 11 | use Domain\ShippingPackaging\Enums\ShippingPackagingTypeEnum; |
| 12 | use Domain\Team\Resources\TeamResource; |
| 13 | use Domain\User\Resources\UserSensitiveResource; |
| 14 | use Illuminate\Database\Eloquent\Collection; |
| 15 | use Illuminate\Http\Request; |
| 16 | use Illuminate\Http\Resources\Json\JsonResource; |
| 17 | |
| 18 | /** |
| 19 | * @property ShippingPackagingStatusEnum $status |
| 20 | * @property int $id |
| 21 | * @property string $created_at |
| 22 | * @property string $updated_at |
| 23 | * @property int $volume |
| 24 | * @property ShippingPackagingTypeEnum $type |
| 25 | * @property Collection $pickingOrders |
| 26 | */ |
| 27 | class ShippingPackagingResource extends JsonResource |
| 28 | { |
| 29 | |
| 30 | public function toArray(Request $request): array |
| 31 | { |
| 32 | return [ |
| 33 | 'id' => $this->id, |
| 34 | 'status' => $this->status->value, |
| 35 | 'volume' => $this->volume, |
| 36 | 'type' => $this->type->value, |
| 37 | 'observation' => $this->observation, |
| 38 | 'team' => TeamResource::make($this->whenLoaded('team')), |
| 39 | 'packaging' => PackagingResource::make($this->whenLoaded('packaging')), |
| 40 | 'shipping_packaging_products' => ShippingPackagingProductResource::collection($this->whenLoaded('products')), |
| 41 | 'responsible' => UserSensitiveResource::make($this->whenLoaded('responsible')), |
| 42 | 'created_at' => (string)$this->created_at, |
| 43 | 'updated_at' => (string)$this->updated_at, |
| 44 | ]; |
| 45 | } |
| 46 | } |