fix : Enum 개별 페이지로 수정
This commit is contained in:
57
app/Enums/OrderStatus.php
Normal file
57
app/Enums/OrderStatus.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
namespace App\Enums;
|
||||
|
||||
/**
|
||||
* 견적 상태 코드 Enum
|
||||
*/
|
||||
enum EstimateStatus: string
|
||||
{
|
||||
case Draft = 'draft'; // 임시저장
|
||||
case Submitted = 'submitted'; // 제출/확정
|
||||
case Approved = 'approved'; // 승인
|
||||
case Rejected = 'rejected'; // 반려
|
||||
case Cancelled = 'cancelled'; // 취소
|
||||
|
||||
// 한글라벨 등 커스텀 메서드
|
||||
public function label(): string
|
||||
{
|
||||
return match($this) {
|
||||
self::Draft => '임시저장',
|
||||
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();
|
||||
}*/
|
||||
Reference in New Issue
Block a user