From 74141d0b7ad55baca1125bb70672e1350e6517f9 Mon Sep 17 00:00:00 2001 From: Hennell <4799852+paulhennell@users.noreply.github.com> Date: Wed, 8 Apr 2026 13:01:04 +0100 Subject: [PATCH 1/2] Add enum helper to column A helper method to the Column class to set column properties directly from an enum. --- src/Column.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Column.php b/src/Column.php index 2b2b82c35..aa0037e57 100644 --- a/src/Column.php +++ b/src/Column.php @@ -55,6 +55,14 @@ public static function make(?string $name = null): static return $static; } + public static function enum(BackedEnum $enum): static + { + return static::make($enum->value) + ->label($enum instanceof \Filament\Support\Contracts\HasLabel ? $enum->getLabel() : null) + ->color($enum instanceof \Filament\Support\Contracts\HasColor ? $enum->getColor() : null) + ->icon($enum instanceof \Filament\Support\Contracts\HasIcon ? $enum->getIcon() : null); + } + public static function getDefaultName(): ?string { return null; From fbb4da78ae949f204a912e8c5937bd6490f29c06 Mon Sep 17 00:00:00 2001 From: Manuk Date: Thu, 9 Apr 2026 01:27:08 +0400 Subject: [PATCH 2/2] Update Column.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/Column.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Column.php b/src/Column.php index aa0037e57..720b9aa6a 100644 --- a/src/Column.php +++ b/src/Column.php @@ -57,10 +57,21 @@ public static function make(?string $name = null): static public static function enum(BackedEnum $enum): static { - return static::make($enum->value) - ->label($enum instanceof \Filament\Support\Contracts\HasLabel ? $enum->getLabel() : null) - ->color($enum instanceof \Filament\Support\Contracts\HasColor ? $enum->getColor() : null) - ->icon($enum instanceof \Filament\Support\Contracts\HasIcon ? $enum->getIcon() : null); + $column = static::make($enum->value); + + if ($enum instanceof \Filament\Support\Contracts\HasLabel) { + $column->label($enum->getLabel()); + } + + if ($enum instanceof \Filament\Support\Contracts\HasColor) { + $column->color($enum->getColor()); + } + + if ($enum instanceof \Filament\Support\Contracts\HasIcon) { + $column->icon($enum->getIcon()); + } + + return $column; } public static function getDefaultName(): ?string