Widget Table BulkAction

I have a problem when i use a bulkaction on a WidgetAction, no matter what selected, everything get selected and updated, any idea what the solution?
BulkAction::make("mark_payed")
->translateLabel()
->icon("heroicon-c-check-circle")
->iconPosition(IconPosition::Before)
->iconSize(IconSize::Small)
->color("success")
->requiresConfirmation()
->modalHeading(__("mark as payed"))
->modalDescription(__("sure to mark payed?"))
->modalSubmitActionLabel(__("Yes, mark it payed"))
->action(function(Collection $records,array $data, HasTable $livewire){

$now = Carbon::now();
foreach ($records as $record){
$record->update([
'order_product_is_com_payed' => 1,
"order_product_date_com_payed" => $now
]);
$record->save();
$livewire->getTableRecords();
}
})
->deselectRecordsAfterCompletion(),
BulkAction::make("mark_payed")
->translateLabel()
->icon("heroicon-c-check-circle")
->iconPosition(IconPosition::Before)
->iconSize(IconSize::Small)
->color("success")
->requiresConfirmation()
->modalHeading(__("mark as payed"))
->modalDescription(__("sure to mark payed?"))
->modalSubmitActionLabel(__("Yes, mark it payed"))
->action(function(Collection $records,array $data, HasTable $livewire){

$now = Carbon::now();
foreach ($records as $record){
$record->update([
'order_product_is_com_payed' => 1,
"order_product_date_com_payed" => $now
]);
$record->save();
$livewire->getTableRecords();
}
})
->deselectRecordsAfterCompletion(),
7 Replies
sandofgods
sandofgodsOP9mo ago
bump bump
toeknee
toeknee9mo ago
Are you on the latest filamentphp version?
sandofgods
sandofgodsOP9mo ago
Yes i composer update daily Currently i'm on 3.2.46 any idea how can i debug it? i didint find a way to check what selected before launching the action. last update didnt change nothing, any clue what function check what selected? i would try to debug it
toeknee
toeknee9mo ago
It looks ok, can you provide a repoduction repository so I can test it
sandofgods
sandofgodsOP9mo ago
Yes i'll do one tomorrow, same for my second bug with the group summaries
sandofgods
sandofgodsOP9mo ago
Hello, Here the repo: https://github.com/ronylicha/bugfphp I have reproduce the bug of my two post here, this one about the group sum with scope not working, and the second one, when you check one or two and do bulk action, all the table got check and updated. What you have to do: update the .env with the db credential and db name
artisan migrate
artisan db:seed
artisan migrate
artisan db:seed
the admin credentials: [email protected]//123456 Go to the commission dashboard and check the two things
GitHub
GitHub - ronylicha/bugfphp
Contribute to ronylicha/bugfphp development by creating an account on GitHub.
sandofgods
sandofgodsOP9mo ago
bump
Want results from more Discord servers?
Add your server