the table action button does not retrieve the correct record

Hello everyone, I have a problem with my code. when I click on payment method action, the correct record is not always retrieved. that's only my probably. Here is my code: //Action de paiement
12 Replies
z-Fabiano Fernandes
Hi, I'm having the same problem. The table action always get the first row of the table
LeandroFerreira
what code are you using?
z-Fabiano Fernandes
@Leandro Ferreira Simple code ... Tables\Actions\Action::make('refund') ->action(function (Model $sale) { dd($sale->id); }) Always get first record orf the table
LeandroFerreira
try YourModel $record
z-Fabiano Fernandes
@Leandro Ferreira Tables\Actions\Action::make('refund') ->action(function (Sale $sale) { dd($sale->id); }) Same problem. Always get first row sale->id 😦
LeandroFerreira
I mean ->action(function (Sale $record) { dd($record->id)..
z-Fabiano Fernandes
@Leandro Ferreira Everything was working perfectly until yesterday. But this code working very well ->url(fn (Model $record): string => '/sales/' . $record->id . '/refund')
LeandroFerreira
?
z-Fabiano Fernandes
Not working
LeandroFerreira
Everything was working perfectly until yesterday. Something that you have changed 🤷‍♂️ and this should work, probably something wrong in your code..
z-Fabiano Fernandes
Simple resource .... Deleted and recreated, but error still exists. Not working (get always first row of table) ->action(function (Sale $record) { dd($record->id)} Working fine ->url(fn (Sale $record): string => '/sales/' . $record->id . '/refund')
LeandroFerreira
share the whole code you are using..
Want results from more Discord servers?
Add your server