#the table action button does not retrieve the correct record

13 messages · Page 1 of 1 (latest)

burnt pollen
#

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

mighty matrix
#

Hi,
I'm having the same problem.
The table action always get the first row of the table

mighty matrix
#

@cyan forum
Simple code ...

Tables\Actions\Action::make('refund')
->action(function (Model $sale) {

        dd($sale->id);

 })

Always get first record orf the table

mighty matrix
#

@cyan forum

Tables\Actions\Action::make('refund')
->action(function (Sale $sale) {

        dd($sale->id);

 })

Same problem. Always get first row sale->id
😦

cyan forum
mighty matrix
#

@cyan forum
Everything was working perfectly until yesterday.

But this code working very well

->url(fn (Model $record): string => '/sales/' . $record->id . '/refund')

cyan forum
#

and this should work, probably something wrong in your code..

mighty matrix
#

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')