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
Just change
string
type to QualityType,
Make sure to import it as wellWhat Salah said. Also check the docs for the HasIcons interface