F
Filamentβ€’17mo ago
sundays

Boolean state for timestamp column

I have a timestamp column that works exactly like deleted_at does for soft deletes. Is this the best way to display such a column as a boolean state, or is there a cleaner way? i.e. I want a verified element (non null) to show a check mark βœ… and a red cross for unverified (null), just like the default boolean() columns.
Solution:
Tables\Columns\IconColumn::make('verified_at')
->boolean()
->getStateUsing(fn ($record): bool => blank($record->verified_at))
Tables\Columns\IconColumn::make('verified_at')
->boolean()
->getStateUsing(fn ($record): bool => blank($record->verified_at))
...
Jump to solution
2 Replies
Solution
LeandroFerreira
LeandroFerreiraβ€’17mo ago
Tables\Columns\IconColumn::make('verified_at')
->boolean()
->getStateUsing(fn ($record): bool => blank($record->verified_at))
Tables\Columns\IconColumn::make('verified_at')
->boolean()
->getStateUsing(fn ($record): bool => blank($record->verified_at))
sundays
sundaysOPβ€’17mo ago
awesome, thanks πŸ™‚
Want results from more Discord servers?
Add your server