F
Filament15mo ago
ekrbodo

IconColumn enum

I´m trying to use a IconColumn on a field which is casting a Enum. I´m getting this error: App\Filament\Resources\QualityResource::App\Filament\Resources{closure}(): Argument #1 ($state) must be of type string, App\Enum\QualityType given Is there another way to get this working? Code-example use Filament\Tables\Columns\IconColumn; IconColumn::make('type') ->icon(fn (string $state): string => match ($state) { 'draft' => 'heroicon-o-pencil', 'reviewing' => 'heroicon-o-clock', 'published' => 'heroicon-o-check-circle', })
2 Replies
Salah Kanjo
Salah Kanjo15mo ago
Just change string type to QualityType, Make sure to import it as well
Dennis Koch
Dennis Koch15mo ago
What Salah said. Also check the docs for the HasIcons interface
Want results from more Discord servers?
Add your server