Skip to content

Commit 5c551a9

Browse files
committed
ResultStatus HasColor
1 parent 5534441 commit 5c551a9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/Enums/ResultStatus.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
namespace App\Enums;
44

5+
use Filament\Support\Contracts\HasColor;
56
use Filament\Support\Contracts\HasLabel;
67

7-
enum ResultStatus: string implements HasLabel
8+
enum ResultStatus: string implements HasLabel, HasColor
89
{
910
case Completed = 'completed'; // a speedtest that ran successfully.
1011
case Failed = 'failed'; // a speedtest that failed to run successfully.
@@ -14,4 +15,13 @@ public function getLabel(): ?string
1415
{
1516
return $this->name;
1617
}
18+
19+
public function getColor(): ?string
20+
{
21+
return match ($this) {
22+
ResultStatus::Completed => 'success',
23+
ResultStatus::Failed => 'danger',
24+
ResultStatus::Started => 'warning',
25+
};
26+
}
1727
}

0 commit comments

Comments
 (0)