Files
minicrm/app/Enums/ContractType.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
981 B
PHP

<?php
namespace App\Enums;
/**
* Contract Type Enum
*
* Để thêm loại hợp đồng 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 ContractType: string
{
case SALE = 'sale';
case LEASE = 'lease';
case BCC = 'bcc';
public function label(): string
{
return match ($this) {
self::SALE => __('enums.contract_type.sale'),
self::LEASE => __('enums.contract_type.lease'),
self::BCC => __('enums.contract_type.bcc'),
};
}
public function color(): string
{
return match ($this) {
self::SALE => 'success',
self::LEASE => 'info',
self::BCC => 'warning',
};
}
public static function options(): array
{
return collect(self::cases())->mapWithKeys(fn ($case) => [
$case->value => $case->label(),
])->toArray();
}
}