public function table(Table $table): Table{ return $table ->query(...) ->columns([ IconColumn::make('visible_to_everyone') ->visible(fn (MyModel $record) => ! $record->created_by_admin) // Problem is here ]) ;}
public function table(Table $table): Table{ return $table ->query(...) ->columns([ IconColumn::make('visible_to_everyone') ->visible(fn (MyModel $record) => ! $record->created_by_admin) // Problem is here ]) ;}
Which throws the following error
Argument #1 ($record) must be of type App\Models\MyModel, null given, called in /var/www/endor/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
Argument #1 ($record) must be of type App\Models\MyModel, null given, called in /var/www/endor/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
Am I missing something? It doesn't matter what type of column I use BTW, when I pass a closure to the
visible
visible
method, it doesn't pass he record as expected.
Everything is up-to-date (LW 3.3, Filament 3.1.23)
Solution
In this case the check was on the user but I see what you mean. I can achieve the same result by either using the
trueIcon()/falseIcon()
trueIcon()/falseIcon()
class or by conditionally adding the column. I just thought using