store-manage/app/Enums/SignStatus.php

55 lines
1.0 KiB
PHP

<?php
namespace App\Enums;
/**
* 打卡状态
*/
enum SignStatus: int
{
/**
* 正常打卡
*/
case Normal = 1;
/**
* 缺卡
*/
case Lose = 2;
/**
* 旷工
*/
case Absent = 3;
public static function options()
{
return [
self::Normal->value => '正常',
self::Lose->value => '缺卡',
self::Absent->value => '旷工',
];
}
public static function source()
{
return [
self::Normal->value => [
'label' => self::Normal->text(),
'color' => '#1b9908',
],
self::Lose->value => [
'label' => self::Lose->text(),
'color' => '#d97116',
],
self::Absent->value => [
'label' => self::Absent->text(),
'color' => '#a61922',
],
];
}
public function text()
{
return data_get(self::options(), $this->value);
}
}