Files
portal-api/app/Enums/TransactionStatus.php

29 lines
627 B
PHP

<?php
namespace App\Enums;
enum TransactionStatus: int
{
case PENDING = 0;
case COMPLETED = 1;
case FAILED = 2;
public function label(): string
{
return match ($this) {
self::PENDING => 'Chờ xử lý',
self::COMPLETED => 'Thành công',
self::FAILED => 'Thất bại',
};
}
public static function getOptions(): array
{
return [
self::PENDING->value => self::PENDING->label(),
self::COMPLETED->value => self::COMPLETED->label(),
self::FAILED->value => self::FAILED->label(),
];
}
}