FilamentF
Filament2y ago
1 reply
Francisco García

Bulk action with relationship toggles

I have to update a belongsToMany relationship via BulkActions.

Let's say I have a modal where I put the values of the realted model and let the user select what are going to be attached so then I can update the pivot table based on the values given.

I don't find a proper field or way to do this.

my toggles generation looks like this:

IntegrationAccount::get()
    ->map(function ($integrationAccount) {
        return [
            Forms\Components\Toggle::make("integration_account[{$integrationAccount->id}][is_enabled]")
                ->label($integrationAccount->label)
                ->default(false),
        ];
    })
    ->flatten(1)
    ->toArray()
image.png
Was this page helpful?