© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
8 replies
marianov24

Relation Manager Resource with pivot - Custom Attach

Hi guys, i create a Relation Manager Resource with pivot. Information:
-> Invoice -> it's the Main Resource
-> Performance -> it's the Relation Manager Resource
-> they have Many to Many relationship.
-> it's work, but i need make a change.
* I have Product table that has Many Performance, So i need on the popup show a Select for Products, when products Select filter the Performance :
->headerActions([
                AttachAction::make()->label('Agregar')
                ->form(fn (AttachAction $action): array => [
                    //$action->getRecordSelect(),
                    
                    Forms\Components\Select::make('product_id')
                        ->relationship('product','external_name')
                        ->afterStateUpdated(fn (callable $set) => $set ('start',null))
                        ->reactive()
                        ->searchable()->required(),
                    Forms\Components\Select::make('start')
                        ->options(function (callable $get){
                                            
                            $product = Product::find($get('product_id'));
                            if (!$product)
                            {
                                return [];
                            }
                            return $product->performances()->pluck('start','id');
                        })->required()
                        
                ]),
            ])
->headerActions([
                AttachAction::make()->label('Agregar')
                ->form(fn (AttachAction $action): array => [
                    //$action->getRecordSelect(),
                    
                    Forms\Components\Select::make('product_id')
                        ->relationship('product','external_name')
                        ->afterStateUpdated(fn (callable $set) => $set ('start',null))
                        ->reactive()
                        ->searchable()->required(),
                    Forms\Components\Select::make('start')
                        ->options(function (callable $get){
                                            
                            $product = Product::find($get('product_id'));
                            if (!$product)
                            {
                                return [];
                            }
                            return $product->performances()->pluck('start','id');
                        })->required()
                        
                ]),
            ])

The form works but when a click on Attach i got an error:
Undefined array key "recordId"
Undefined array key "recordId"

I imagine that to solve this I should use:
 Relation Manager Resource with pivot - Custome Attach  
 Relation Manager Resource with pivot - Custome Attach  

But I do not know how to do it
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
help attach 2 relation manager into a pivot table
FilamentFFilament / ❓┊help
3y ago
Relation Manager with Pivot and ordering on pivot
FilamentFFilament / ❓┊help
3y ago