36 lines
800 B
PHP
36 lines
800 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use Dcat\Admin\Admin;
|
|
|
|
enum DrawLogStatus: int {
|
|
case Pending = 0;
|
|
case Queuing = 1;
|
|
case Completed = 5;
|
|
|
|
public function label()
|
|
{
|
|
$color = match ($this) {
|
|
static::Pending => 'primary',
|
|
static::Queuing => 'pink',
|
|
static::Completed => 'success',
|
|
};
|
|
|
|
$background = Admin::color()->get($color, $color);
|
|
|
|
$name = static::options()[$this->value] ?? '其它';
|
|
|
|
return "<span class='label' style='background: $background;'>{$name}</span>";
|
|
}
|
|
|
|
public static function options()
|
|
{
|
|
return [
|
|
static::Pending->value => '待处理',
|
|
static::Queuing->value => '发放中',
|
|
static::Completed->value => '已完成',
|
|
];
|
|
}
|
|
}
|