© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Azorky

Relation manager attach one-to-many

I have a relation manager between
projects
projects
and
purchace_invoices
purchace_invoices
(one-to-many).
In the relation manager I want to be able to attach existing purchase invoices to a project, but I cant see to figure out how.
Solution
Action::make('aankoopfactuurKoppelen')
                    ->color('gray')
                    ->form([
                        Select::make('id')
                            ->label('Purchase Invoice')
                            ->options(PurchaseInvoice::query()->pluck('invoice_number', 'id'))
                            ->native(false)
                            ->multiple()
                            ->searchable()
                            ->required(),
                    ])
                    ->action(function (array $data): void {
                        PurchaseInvoice::whereIn('id', $data['id'])->update(['project_id' => $this->ownerRecord->id]);
                    })
Action::make('aankoopfactuurKoppelen')
                    ->color('gray')
                    ->form([
                        Select::make('id')
                            ->label('Purchase Invoice')
                            ->options(PurchaseInvoice::query()->pluck('invoice_number', 'id'))
                            ->native(false)
                            ->multiple()
                            ->searchable()
                            ->required(),
                    ])
                    ->action(function (array $data): void {
                        PurchaseInvoice::whereIn('id', $data['id'])->update(['project_id' => $this->ownerRecord->id]);
                    })

This fixed it
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Attach relation manager
FilamentFFilament / ❓┊help
3y ago
Attach Relation Manager
FilamentFFilament / ❓┊help
3y ago
sushi many to many relation manager
FilamentFFilament / ❓┊help
2y ago
Relation manager Many to Many relationship
FilamentFFilament / ❓┊help
3y ago