Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

1.3 KB
Raw Blame
<?php

namespace HiEvents\Resources\Product;

use HiEvents\DomainObjects\ProductPriceDomainObject;
use HiEvents\Resources\BaseResource;
use Illuminate\Http\Request;

/**
 * @mixin ProductPriceDomainObject
 */
class ProductPriceResource extends BaseResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->getId(),
            'label' => $this->getLabel(),
            'price' => $this->getPrice(),
            'sale_start_date' => $this->getSaleStartDate(),
            'sale_end_date' => $this->getSaleEndDate(),
            'is_before_sale_start_date' => $this->isBeforeSaleStartDate(),
            'is_after_sale_end_date' => $this->isAfterSaleEndDate(),
            'is_available' => $this->isAvailable(),
            'initial_quantity_available' => $this->getInitialQuantityAvailable(),
            'quantity_sold' => $this->getQuantitySold(),
            /** @var 'OCCURRENCE'|'EVENT' */
            'quantity_applies_to' => $this->getQuantityAppliesTo(),
            'is_sold_out' => $this->isSoldOut(),
            'is_locked_behind_earlier_tier' => $this->isLockedBehindEarlierTier(),
            'is_hidden' => $this->getIsHidden(),
            'off_sale_reason' => $this->getOffSaleReason(),
            'price_including_taxes_and_fees' => $this->getPriceIncludingTaxAndServiceFee(),
        ];
    }
}