© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
11 replies
*

formatStateUsing() and a nullable boolean column

I have a nullable boolean column in a table like:
$table->boolean('decision')->nullable();
$table->boolean('decision')->nullable();

In my Filament table, I'm trying to display 'Pending' for the null value and 'Accepted' or 'Rejected' correspondingly for
true
true
and
false
false


I do not get any
$state
$state
or
Model $record
Model $record
for the null values at all.

TextColumn::make('decision')
  ->badge()
  ->formatStateUsing(function (Model $record) {
      dump($record);
  })
  ...
TextColumn::make('decision')
  ->badge()
  ->formatStateUsing(function (Model $record) {
      dump($record);
  })
  ...

will not dump anything at all, but works as expected for the non-null values.
same with
TextColumn::make('decision')
  ->badge()
  ->formatStateUsing(function (string $state) {
    dump($state)
  })
  ...
TextColumn::make('decision')
  ->badge()
  ->formatStateUsing(function (string $state) {
    dump($state)
  })
  ...


Any insight would be appreciated.
Solution
Try
getStateUsing()
getStateUsing()
.
null
null
values are filteres and there is not
formatStateUsing()
formatStateUsing()
for them
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

I have a boolean column published
FilamentFFilament / ❓┊help
3y ago
Boolean state for timestamp column
FilamentFFilament / ❓┊help
3y ago
Repeater - formatStateUsing
FilamentFFilament / ❓┊help
3y ago
refresh form and apply formatStateUsing
FilamentFFilament / ❓┊help
3y ago