diff --git a/app/Enums/BusinessStatus.php b/app/Enums/EstimateStatus.php similarity index 100% rename from app/Enums/BusinessStatus.php rename to app/Enums/EstimateStatus.php diff --git a/app/Enums/OrderStatus.php b/app/Enums/OrderStatus.php new file mode 100644 index 0000000..d057b53 --- /dev/null +++ b/app/Enums/OrderStatus.php @@ -0,0 +1,57 @@ + '임시저장', + self::Submitted => '제출/확정', + self::Approved => '승인', + self::Rejected => '반려', + self::Cancelled => '취소', + }; + } +} + +/** + * 주문 상태 코드 Enum + */ +enum OrderStatus: string +{ + case Created = 'created'; + case Confirmed = 'confirmed'; + case InProgress = 'in_progress'; + case Completed = 'completed'; + case Cancelled = 'cancelled'; + + // 한글라벨 등 커스텀 메서드 + public function label(): string + { + return match($this) { + self::Created => '등록', + self::Confirmed => '승인', + self::InProgress => '진행중', + self::Completed => '완료', + self::Cancelled => '취소', + }; + } +} + +// 사용 +/*foreach (EstimateStatus::cases() as $status) { + echo $status->name; + echo $status->value; + echo $status->label(); +}*/