PhyrePanel-mirror/web/app/Filament/Enums/BackupStatus.php

50 lines
1.3 KiB
PHP
Raw Normal View History

2024-04-25 09:30:01 +00:00
<?php
namespace App\Filament\Enums;
use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasIcon;
use Filament\Support\Contracts\HasLabel;
enum BackupStatus: string implements HasColor, HasIcon, HasLabel
{
case Pending = 'pending';
case Processing = 'processing';
case Completed = 'completed';
case Failed = 'failed';
case Cancelled = 'cancelled';
public function getLabel(): string
{
return match ($this) {
self::Pending => 'Pending',
self::Processing => 'Processing',
self::Completed => 'Completed',
self::Failed => 'Failed',
self::Cancelled => 'Cancelled',
};
}
public function getColor(): string | array | null
{
return match ($this) {
self::Pending => 'info',
self::Cancelled => 'warning',
self::Processing => 'warning',
self::Completed => 'success',
self::Failed => 'danger',
};
}
public function getIcon(): ?string
{
return match ($this) {
self::Pending => 'heroicon-m-sparkles',
self::Processing => 'heroicon-m-arrow-path',
self::Cancelled => 'heroicon-m-truck',
self::Completed => 'heroicon-m-check-badge',
self::Failed => 'heroicon-m-x-circle',
};
}
}