How call a function from SelectColumn in table?

Hello, how can I call a function from SelectColumn in table?
14 Replies
Dan Harrin
Dan Harrin2y ago
I think there is an updateStateUsing()
José
JoséOP2y ago
Is there an example in the doc? I saw this, I don't know if it is this https://filamentphp.com/docs/2.x/forms/advanced#updates I would like to call this method that I attach capture
Filament
Advanced - Form Builder - Filament
The elegant TALL stack form builder for Laravel artisans.
José
JoséOP2y ago
it give me error...
Dan Harrin
Dan Harrin2y ago
Select is not a SelectColumn, they have different methods Please try with updateStateUsing()
José
JoséOP2y ago
ok and without ->reactive() ?
Dan Harrin
Dan Harrin2y ago
yes
José
JoséOP2y ago
Unable to resolve dependency [Parameter #1 [ <required> callable $set ]] in class ->updateStateUsing(function ($state, callable $set) { dd($set); I tried dd with $state also but same error
Dan Harrin
Dan Harrin2y ago
you dont need to $set you need to update the $record like you would in laravel $record->update['col1' => $state, 'col2' => dependant calculated value here]
José
JoséOP2y ago
ok thanks....can I call a function that I've in EditResource?
Dan Harrin
Dan Harrin2y ago
i dont understand
José
JoséOP2y ago
so as not to have to repeat all that code when changing in the select
José
JoséOP2y ago
when I change the select I've to do all you can see there
Dan Harrin
Dan Harrin2y ago
extract it into an action class or a method on your model theres no need to copy code, just use PHP to make an abstraction
José
JoséOP2y ago
ok thanks

Did you find this page helpful?