Files
minicrm/app/Enums/ServiceType.php
phuongtc efa97b6c71
Some checks failed
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
Tests / PHP 8.5 (push) Has been cancelled
them log, chinh upload
2026-05-09 11:00:59 +00:00

44 lines
1.1 KiB
PHP

<?php
namespace App\Enums;
/**
* Service Type Enum
*
* Để thêm loại dịch vụ mới:
* 1. Thêm case mới vào enum
* 2. Thêm label trong lang/vi/enums.php và lang/en/enums.php
* 3. Reload browser
*/
enum ServiceType: string
{
case MANAGEMENT_FEE = 'management_fee';
case GRATITUDE = 'gratitude';
case SELF_BUSINESS = 'self_business';
public function label(): string
{
return match ($this) {
self::MANAGEMENT_FEE => __('enums.service.management_fee'),
self::GRATITUDE => __('enums.service.gratitude'),
self::SELF_BUSINESS => __('enums.service.self_business'),
};
}
public function color(): string
{
return match ($this) {
self::MANAGEMENT_FEE => 'info',
self::GRATITUDE => 'success',
self::SELF_BUSINESS => 'warning',
};
}
public static function options(): array
{
return collect(self::cases())->mapWithKeys(fn ($case) => [
$case->value => $case->label(),
])->toArray();
}
}