F
Filament17mo ago
Óscar

Action in ToggleColumn

Hi. I have the following code in a table of a resource: Tables\Columns\ToggleColumn::make('is_premium') ->searchable() ->sortable() ->action( function(User $record) { dd($record); } ), What I want to achieve is that when I click on the cell, the function inside ->action() is triggered to implement additional logic of the column value change. It only works if I change the column type to TextColumn, but with ToggleColumn nothing happens. Any idea? thanks
4 Replies
LeandroFerreira
LeandroFerreira17mo ago
You can use updateStateUsing()
Óscar
ÓscarOP17mo ago
I got Method Filament\Tables\Columns\ToggleColumn::updateStateUsing does not exist Is this way correct? Tables\Columns\ToggleColumn::make('is_premium') ->searchable() ->sortable() ->updateStateUsing(function($state, $record) { dd($state, $record); } ), I'm using filament 2.16
LeandroFerreira
LeandroFerreira17mo ago
GitHub
filament/packages/tables/src/Columns/Concerns/CanUpdateState.php at...
Admin panel, form builder and table builder for Laravel. Built with the TALL stack. Designed for humans. - filament/packages/tables/src/Columns/Concerns/CanUpdateState.php at 2.x · filamentphp/fila...
mohdaftab
mohdaftab14mo ago
Hi, I need to add a resource for my taggables table which I need to use to approve or deny the service as locked or unlocked, please let me know how do I do that without the model?
Want results from more Discord servers?
Add your server