Tricks

Allow multiple records in a Attach select

Sep 21, 2022
Dennis
Admin panel, Table builder

With the default Filament select, it is possible to have a single select (inside the modal) to attach relationships. Sadly, you can't attach multiple records with the default select.

Solving this is fairly easy, we'll take an AttachAction as example:

Tables\Actions\AttachAction::make()

Change this to:

Tables\Actions\AttachAction::make()
->recordSelect(function (Select $select) {
return $select->multiple();
}),

Now, the AttachAction select is a multi-select.

No comments yet…