update
This commit is contained in:
@@ -58,15 +58,13 @@ class Order extends Model
|
||||
// Helpers
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* orders.status là tinyInteger (OrderStatus), không phải chuỗi — bản cũ match 'pending'/
|
||||
* 'completed'… nên mọi giá trị đều rơi vào default và hiển thị ra "0", "1", "2".
|
||||
*/
|
||||
public function getStatusLabelAttribute(): string
|
||||
{
|
||||
return match ($this->status) {
|
||||
'pending' => 'Chờ xử lý',
|
||||
'processing' => 'Đang xử lý',
|
||||
'completed' => 'Hoàn tất',
|
||||
'cancelled' => 'Đã hủy',
|
||||
default => ucfirst($this->status),
|
||||
};
|
||||
return \App\Enums\Order\OrderStatus::tryFrom((int) $this->status)?->label() ?? 'Không xác định';
|
||||
}
|
||||
|
||||
public function payment()
|
||||
|
||||
Reference in New Issue
Block a user