Files
portal-api/app/Enums/Status.php
T
2026-02-02 09:07:33 +07:00

33 lines
766 B
PHP

<?php
namespace App\Enums;
enum Status: int
{
case DEACTIVE = 0;
case ACTIVE = 1;
public function label(): string
{
return match ($this) {
self::DEACTIVE => 'Không hoạt động',
self::ACTIVE => 'Hoạt động',
};
}
public function badge(): string
{
return match ($this) {
self::DEACTIVE => '<span class="badge badge-danger">Không hoạt động</span>',
self::ACTIVE => '<span class="badge badge-success">Hoạt động</span>',
};
}
public static function getOptions(): array
{
return [
self::DEACTIVE->value => self::DEACTIVE->label(),
self::ACTIVE->value => self::ACTIVE->label(),
];
}
}