74 lines
1.9 KiB
PHP
74 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Enum;
|
|
|
|
enum OrderStatus: string
|
|
{
|
|
case Pending = 'pending';
|
|
case Confirmed = 'confirmed';
|
|
case Preparing = 'preparing';
|
|
case Ready = 'ready';
|
|
case Served = 'served';
|
|
case OutForDelivery = 'out_for_delivery';
|
|
case Completed = 'completed';
|
|
case Cancelled = 'cancelled';
|
|
case Refunded = 'refunded';
|
|
case Online = 'online';
|
|
case QrOrder = 'qr_order';
|
|
case TodayOrder = 'today_order';
|
|
|
|
// Optional: static constants for non-enum usage
|
|
public const PENDING = 'pending';
|
|
|
|
public const CONFIRMED = 'confirmed';
|
|
|
|
public const PREPARING = 'preparing';
|
|
|
|
public const READY = 'ready';
|
|
|
|
public const SERVED = 'served';
|
|
|
|
public const OUT_FOR_DELIVERY = 'out_for_delivery';
|
|
|
|
public const COMPLETED = 'completed';
|
|
|
|
public const CANCELLED = 'cancelled';
|
|
|
|
public const REFUNDED = 'refunded';
|
|
|
|
public const ONLINE = 'online';
|
|
|
|
public const QR_ORDER = 'qr_order';
|
|
|
|
public const TODAY_ORDER = 'today_order';
|
|
|
|
/**
|
|
* Get all status values as array
|
|
*/
|
|
public static function values(): array
|
|
{
|
|
return array_column(self::cases(), 'value');
|
|
}
|
|
|
|
/**
|
|
* Display labels for UI
|
|
*/
|
|
public static function labels(): array
|
|
{
|
|
return [
|
|
self::Pending->value => 'Pending',
|
|
self::Confirmed->value => 'Confirmed',
|
|
self::Preparing->value => 'Preparing',
|
|
self::Ready->value => 'Ready',
|
|
self::Served->value => 'Served',
|
|
self::OutForDelivery->value => 'Out For Delivery',
|
|
self::Completed->value => 'Completed',
|
|
self::Cancelled->value => 'Cancelled',
|
|
self::Refunded->value => 'Refunded',
|
|
self::Online->value => 'Online',
|
|
self::QrOrder->value => 'QR Order',
|
|
self::TodayOrder->value => 'Today Order',
|
|
];
|
|
}
|
|
}
|