Version 2.0
This commit is contained in:
39
app/Enums/ContractCategory.php
Normal file
39
app/Enums/ContractCategory.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
/**
|
||||
* Contract Category Enum — Phân loại hợp đồng cấp cao
|
||||
*
|
||||
* Mỗi căn hộ chỉ có tối đa 1 HĐ active mỗi category tại cùng thời điểm.
|
||||
* - ownership: Sở hữu (đặt cọc, mua bán, chuyển nhượng...)
|
||||
* - business: Kinh doanh (cho thuê, tự doanh, hợp tác KD...)
|
||||
*/
|
||||
enum ContractCategory: string
|
||||
{
|
||||
case OWNERSHIP = 'ownership';
|
||||
case BUSINESS = 'business';
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::OWNERSHIP => __('enums.contract_category.ownership'),
|
||||
self::BUSINESS => __('enums.contract_category.business'),
|
||||
};
|
||||
}
|
||||
|
||||
public function color(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::OWNERSHIP => 'success',
|
||||
self::BUSINESS => 'info',
|
||||
};
|
||||
}
|
||||
|
||||
public static function options(): array
|
||||
{
|
||||
return collect(self::cases())->mapWithKeys(fn ($case) => [
|
||||
$case->value => $case->label(),
|
||||
])->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user