Mellor
Mellor
FFilament
Created by Mellor on 8/3/2023 in #❓┊help
Using `icons` with IconColumn
Hi, I'm just playing with the Table Builder and using the User model for example. I was looking at using the IconColumn on the email_verified_at column, to show if it is verified or not. I think this class is better suited to a boolean field, but just trying it out. I saw the options method was deprecated (though no mention of that in the docs) and saw it recommended to use icons instead. I tried:
IconColumn::make('email_verified_at')
->label('Email verified?')
->icons(fn ($record) => [
'heroicon-o-x-mark' => is_null($record->email_verified_at),
'heroicon-o-check-circle' => ! is_null($record->email_verified_at),
]),
IconColumn::make('email_verified_at')
->label('Email verified?')
->icons(fn ($record) => [
'heroicon-o-x-mark' => is_null($record->email_verified_at),
'heroicon-o-check-circle' => ! is_null($record->email_verified_at),
]),
But I get no icons. I also tried with the icon method and a ternary operator
->icon(fn ($record) => is_null($record->email_verified_at) ? 'heroicon-o-x-mark' : 'heroicon-o-check-circle'),
->icon(fn ($record) => is_null($record->email_verified_at) ? 'heroicon-o-x-mark' : 'heroicon-o-check-circle'),
This gets me a bit further and shows the ✅ but not the ❌ Perhaps I'm missing something? Thanks.
9 replies