© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
Dimitar

Modify query on AttachAction

Hello,

I have this code, allowing to attach more products with BelongsToMany Relation:
    Tables\Actions\AttachAction::make()
                    ->preloadRecordSelect()
                    ->form(fn(Tables\Actions\AttachAction $action): array => [
                        $action->getRecordSelect()->required(),
                        Forms\Components\ColorPicker::make('color')
                            ->required()
                    ])
    Tables\Actions\AttachAction::make()
                    ->preloadRecordSelect()
                    ->form(fn(Tables\Actions\AttachAction $action): array => [
                        $action->getRecordSelect()->required(),
                        Forms\Components\ColorPicker::make('color')
                            ->required()
                    ])


It works, but I want to modify the query when saving, to add the inverse record in the DB, how do your do that ?


Tried
$action->getRecordSelect()->saveRelationshipsUsing
$action->getRecordSelect()->saveRelationshipsUsing
, but since it doesnt have
->relationship
->relationship
chained it doesnt work.

Is there any way to do this, event if its not trough filament?

Thanks!
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Relation Manager: Can't modify AttachAction
FilamentFFilament / ❓┊help
3y ago
Exporter: Modify Query based on Options?
FilamentFFilament / ❓┊help
2y ago
Modify global search query
FilamentFFilament / ❓┊help
3mo ago
Conditionally modify query based on column visibility
FilamentFFilament / ❓┊help
3y ago