Skip to content

Commit d22db76

Browse files
wdogalexjustesen
andauthored
Feature/result hascolor (alexjustesen#1347)
Co-authored-by: Alex Justesen <[email protected]>
1 parent 2640b06 commit d22db76

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 HasColor, HasLabel
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+
self::Completed => 'success',
23+
self::Failed => 'danger',
24+
self::Started => 'warning',
25+
};
26+
}
1727
}

0 commit comments

Comments
 (0)