them log, chinh upload
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

This commit is contained in:
2026-05-09 11:00:59 +00:00
parent 96e1ce4f40
commit efa97b6c71
33 changed files with 1055 additions and 47 deletions

View File

@@ -2,6 +2,14 @@
namespace App\Enums;
/**
* Contract Status Enum
*
* Để thêm trạng thái mới:
* 1. Thêm case mới vào enum
* 2. Thêm label trong lang/vi/enums.php lang/en/enums.php
* 3. Reload browser
*/
enum ContractStatus: string
{
case ACTIVE = 'active';
@@ -17,12 +25,19 @@ enum ContractStatus: string
};
}
public function options(): array
public function color(): string
{
return [
self::ACTIVE->value => self::ACTIVE->label(),
self::EXPIRED->value => self::EXPIRED->label(),
self::LIQUIDATED->value => self::LIQUIDATED->label(),
];
return match ($this) {
self::ACTIVE => 'success',
self::EXPIRED => 'warning',
self::LIQUIDATED => 'danger',
};
}
public static function options(): array
{
return collect(self::cases())->mapWithKeys(fn ($case) => [
$case->value => $case->label(),
])->toArray();
}
}