50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Enum;
|
||
|
|
|
||
|
|
enum TrackingStatus: string
|
||
|
|
{
|
||
|
|
case Placed = 'placed';
|
||
|
|
case Accepted = 'accepted';
|
||
|
|
case Preparing = 'preparing';
|
||
|
|
case Dispatched = 'dispatched';
|
||
|
|
case Delivered = 'delivered';
|
||
|
|
case Cancelled = 'cancelled';
|
||
|
|
|
||
|
|
// Optional constants
|
||
|
|
public const PLACED = 'placed';
|
||
|
|
|
||
|
|
public const ACCEPTED = 'accepted';
|
||
|
|
|
||
|
|
public const PREPARING = 'preparing';
|
||
|
|
|
||
|
|
public const DISPATCHED = 'dispatched';
|
||
|
|
|
||
|
|
public const DELIVERED = 'delivered';
|
||
|
|
|
||
|
|
public const CANCELLED = 'cancelled';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get all enum values
|
||
|
|
*/
|
||
|
|
public static function values(): array
|
||
|
|
{
|
||
|
|
return array_column(self::cases(), 'value');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* UI Labels
|
||
|
|
*/
|
||
|
|
public static function labels(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
self::Placed->value => 'Placed',
|
||
|
|
self::Accepted->value => 'Accepted',
|
||
|
|
self::Preparing->value => 'Preparing',
|
||
|
|
self::Dispatched->value => 'Dispatched',
|
||
|
|
self::Delivered->value => 'Delivered',
|
||
|
|
self::Cancelled->value => 'Cancelled',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|