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/SBogers10/stempel.komma.pro/app/Komma/Shop/Orders/Resources/Order.php
<?php

namespace App\Komma\Shop\Orders\Resources;

use App\Komma\Users\Resources\UserResource;
use Illuminate\Http\Resources\Json\Resource;

/**
 * Resource for transforming an order into json
 * @see https://laravel.com/docs/5.5/eloquent-resources
 * @see \App\Komma\Shop\Orders\Models\Order
 */
class Order extends Resource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'status' => $this->status,
            'total_price' => $this->total_price,
            'discount' => $this->discount,
            'invoice_gender' => $this->invoice_gender,
            'invoice_title' => $this->invoice_title,
            'invoice_first_name' => $this->invoice_first_name,
            'invoice_last_name' => $this->invoice_last_name,
            'invoice_email' => $this->invoice_email,
            'invoice_company' => $this->invoice_company,
            'invoice_country' => $this->invoice_country,
            'invoice_postal_code' => $this->invoice_postal_code,
            'invoice_city' => $this->invoice_city,
            'invoice_street' => $this->invoice_street,
            'invoice_house_number' => $this->invoice_house_number,
            'invoice_telephone' => $this->invoice_telephone,
            'shipping_gender' => $this->shipping_gender,
            'shipping_title' => $this->shipping_title,
            'shipping_first_name' => $this->shipping_first_name,
            'shipping_last_name' => $this->shipping_last_name,
            'shipping_email' => $this->shipping_email,
            'shipping_company' => $this->shipping_company,
            'shipping_country' => $this->shipping_country,
            'shipping_postal_code' => $this->shipping_postal_code,
            'shipping_city' => $this->shipping_city,
            'shipping_street' => $this->shipping_street,
            'shipping_house_number' => $this->shipping_house_number,
            'shipping_telephone' => $this->shipping_telephone,
            'customer' => $this->whenLoaded('customer',  new UserResource($this->customer)),
            'orderedProducts' => $this->whenLoaded('orderedProducts', OrderedProduct::collection($this->orderedProducts)),
            'orderedProductGroups' => $this->whenLoaded('orderedProductGroups', OrderedProductGroup::collection($this->orderedProductGroups)),
//            'orderedProductComposites' => $this->when('orderedProductComposites', OrderedProductComposite::collection($this->orderedProductComposites)),
        ];
    }
}