store-manage/app/Enums/StoreRole.php

36 lines
601 B
PHP

<?php
namespace App\Enums;
/**
* 店员身份
*/
enum StoreRole: int
{
case Master = 1;
case Employee = 2;
public static function map()
{
return [
self::Master->value => '店长',
self::Employee->value => '店员',
];
}
public static function options()
{
$list = [];
foreach (self::map() as $key => $value) {
array_push($list, ['label' => $value, 'value' => $key]);
}
return $list;
}
public function text()
{
return data_get(self::map(), $this->value);
}
}