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 ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
<?php
namespace HiEvents\Resources\Product;
use HiEvents\DomainObjects\ProductPriceDomainObject;
use HiEvents\Resources\BaseResource;
use Illuminate\Http\Request;
/**
* @mixin ProductPriceDomainObject
*/
class ProductPriceResourcePublic extends BaseResource
{
public const SHOW_QUANTITY_AVAILABLE = 'show_quantity_available';
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(),
'price_including_taxes_and_fees' => $this->getPriceIncludingTaxAndServiceFee(),
'price_before_discount' => $this->getPriceBeforeDiscount(),
/** @var float|null */
'price_before_discount_including_taxes_and_fees' => $this->getPriceBeforeDiscountIncludingTaxesAndFees(),
'is_discounted' => (bool) $this->getPriceBeforeDiscount(),
'tax_total' => $this->getTaxTotal(),
'fee_total' => $this->getFeeTotal(),
'is_before_sale_start_date' => $this->isBeforeSaleStartDate(),
'is_after_sale_end_date' => $this->isAfterSaleEndDate(),
'is_available' => $this->isAvailable(),
'is_sold_out' => $this->isSoldOut(),
/** @var 'OCCURRENCE'|'EVENT' */
'quantity_applies_to' => $this->getQuantityAppliesTo(),
'is_locked_behind_earlier_tier' => $this->isLockedBehindEarlierTier(),
/** @var array<string, float>|null */
'band_prices' => $this->getBandPrices() === null ? null : (object) $this->getBandPrices(),
$this->mergeWhen($this->getAdditionalDataByKey(self::SHOW_QUANTITY_AVAILABLE), fn () => [
'quantity_remaining' => $this->getQuantityAvailable(),
]),
];
}
}