From 244b6974a93ce183789604af4b55836d6b2fb1a4 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Fri, 6 Dec 2024 12:33:43 +0200 Subject: [PATCH] Update ServiceStatus.php --- web/Modules/Email/App/Enums/ServiceStatus.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/web/Modules/Email/App/Enums/ServiceStatus.php b/web/Modules/Email/App/Enums/ServiceStatus.php index 61aa479..aa6bb62 100644 --- a/web/Modules/Email/App/Enums/ServiceStatus.php +++ b/web/Modules/Email/App/Enums/ServiceStatus.php @@ -2,7 +2,10 @@ namespace Modules\Email\App\Enums; -enum ServiceStatus: string +use Filament\Support\Contracts\HasColor; +use Filament\Support\Contracts\HasLabel; + +enum ServiceStatus: string implements HasLabel, HasColor { case ACTIVE = 'Active'; case RUNNING = 'Running'; @@ -10,7 +13,17 @@ enum ServiceStatus: string case INACTIVE = 'Inactive'; - public function color(): string + public function getLabel(): ?string + { + return match ($this) { + self::ACTIVE => 'Active', + self::INACTIVE => 'Inactive', + self::RUNNING => 'Running', + self::NOT_RUNNING => 'Not Running', + }; + } + + public function getColor(): string | array | null { return match ($this) { self::ACTIVE => 'success',