Group action (question/help request)

Hello everybody, kindly asking if it's possible to make a group action in Filament. Let's say i have table with materials, grouped by pallet number (id). So i can edit/delete/whatever each material. Can i also add action for whole group (pallet) in the same table? If yes, can you point me the right way how to do that? Many many thanks for your replies and help 😉
6 Replies
Tieme
Tieme•10mo ago
Michal Čabala
Michal ČabalaOP•10mo ago
Yes, but i would like to add these actions to group of records - https://filamentphp.com/docs/3.x/tables/grouping
Michal Čabala
Michal ČabalaOP•10mo ago
I will explain: i have table of records grouped by relation (materials on pallets). Pallet is stored in some location in shelves in warehouse. So i would like to have actions for each material and also for each pallet in one table.
Tieme
Tieme•10mo ago
I dont think it is possible to add actions to a group. i think you can build it yourself with actions and form something like.
Action::make('updatePallets')
->form([
Select::make('pallets')
->label('Pallet')
->options(Pallet::query()->distinct()->pluck('pallet_name')->toArray())
->required(),
// Other fields
])
->action(function (array $data): void {
Pallet::where('pallet_name', $data['pallets'])
->update([
'key' => $data['value']
]);
})
Action::make('updatePallets')
->form([
Select::make('pallets')
->label('Pallet')
->options(Pallet::query()->distinct()->pluck('pallet_name')->toArray())
->required(),
// Other fields
])
->action(function (array $data): void {
Pallet::where('pallet_name', $data['pallets'])
->update([
'key' => $data['value']
]);
})
Michal Čabala
Michal ČabalaOP•10mo ago
Thanks for your reply. I thought it's not possible right now, so I hope it will be able to do it in the future 🙂
Tieme
Tieme•10mo ago
You can always make a PR to the main repo if you haven build it.
Want results from more Discord servers?
Add your server