© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•14mo ago•
20 replies
Mokatchi

AttachAction in relationManager

I have a question about a situation I'm encoutring on my project. I have a PartnersRelationManager into my projectResource, I'm using create action if there are no partners to attach and then I show the attach btn. But what I really want, is to add a create btn in the attachAction, so I can create a new partner if I didn't find the exact partner to attach from the select list.
Any ideas??
Thank you
Solution
->headerActions([
                Tables\Actions\AttachAction::make()
                    ->preloadRecordSelect() // Preload the select field values
                    ->recordSelect(fn (Select $select) => $select->placeholder(__('projProgRelations.choosePartner'))) // change the select placeholder text
                    ->extraModalFooterActions([
                        Tables\Actions\CreateAction::make()
                            ->form([
                                    TextInput::make('organism')
                                        ->label(__('projProgRelations.organism'))
                                        ->maxLength(255)
                                        ->required(),
                                    TextInput::make('name')
                                        ->label(__('projProgRelations.agentName')),
                                    TextInput::make('gsm')
                                        ->label(__('projProgRelations.agentGsm'))
                                        ->tel()
                                        ->unique(ignoreRecord:true)
                                        ->maxLength(10),
                                    TextInput::make('phone')
                                        ->label(__('projProgRelations.organismPhone'))
                                        ->tel()
                                        ->unique(ignoreRecord:true)
                                        ->maxLength(10),
                                    TextInput::make('email')
                                        ->label(__('projProgRelations.agentEmail'))
                                        ->email()
                                        ->maxLength(255)
                                        ->unique(ignoreRecord:true),
                            ]) 
                    ])
            ])
->headerActions([
                Tables\Actions\AttachAction::make()
                    ->preloadRecordSelect() // Preload the select field values
                    ->recordSelect(fn (Select $select) => $select->placeholder(__('projProgRelations.choosePartner'))) // change the select placeholder text
                    ->extraModalFooterActions([
                        Tables\Actions\CreateAction::make()
                            ->form([
                                    TextInput::make('organism')
                                        ->label(__('projProgRelations.organism'))
                                        ->maxLength(255)
                                        ->required(),
                                    TextInput::make('name')
                                        ->label(__('projProgRelations.agentName')),
                                    TextInput::make('gsm')
                                        ->label(__('projProgRelations.agentGsm'))
                                        ->tel()
                                        ->unique(ignoreRecord:true)
                                        ->maxLength(10),
                                    TextInput::make('phone')
                                        ->label(__('projProgRelations.organismPhone'))
                                        ->tel()
                                        ->unique(ignoreRecord:true)
                                        ->maxLength(10),
                                    TextInput::make('email')
                                        ->label(__('projProgRelations.agentEmail'))
                                        ->email()
                                        ->maxLength(255)
                                        ->unique(ignoreRecord:true),
                            ]) 
                    ])
            ])
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

RelationManager ->table ->attachAction
FilamentFFilament / ❓┊help
3y ago
Using accessor in RelationManager AttachAction not working
FilamentFFilament / ❓┊help
13mo ago
Use value from parent model as default in attachAction relationmanager
FilamentFFilament / ❓┊help
2y ago
afterCreate in AttachAction
FilamentFFilament / ❓┊help
3y ago