HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/brameda/brameda.nl/app/Komma/Shop/Orders/Resources/OrderedProductComposite.php
<?php

namespace App\Komma\Shop\Orders\Resources;

use App\Komma\Shop\Products\ProductComposite\ProductCompositeResource;
use App\Komma\Shop\Products\ProductGroup\ProductGroupResource;
use Illuminate\Http\Resources\Json\Resource;

class OrderedProductComposite extends Resource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'order_id' => $this->order_id,
            'active' => $this->active,
            'quantity' => $this->quantity,
            'discount' => $this->discount,
            'orderedGroups' => $this->whenLoaded('orderedGroups', OrderedProductGroup::collection($this->orderedGroups)),
            'groups' => $this->whenLoaded('groups', ProductGroupResource::collection($this->groups)),
            'productComposite' => $this->whenLoaded('productComposite', new ProductCompositeResource($this->productComposite)),
        ];
    }
}