relationManger nested

I'm building admin and user panel with filament.

in admin panel i have a usersResource and relationManger that is name is "CampaignsRelationManager".

in user panel i have a campaigns resource and relationManger that is name is "CampCouponRelationManager".

i want to add CampCouponRelationManager to CampaignsRelationManager under the admin panel.

Basically, it means to create a relationManger inside a relationManger
Solution
Yeah sure, it is just a custom action on the table:
Inside your relationmanager in the actions array you can do something like this:

->actions([
                Action::make('attachments')
                    ->label(fn($record) => 'Attachments (' . $record->attachments->count() . ')')
                    ->icon('heroicon-o-paper-clip')
                    ->fillForm(fn(Product $record): array => [
                        'attachments' => $record->attachments
                    ])
                    ->modalHeading('Product Attachments toevoegen')
                    ->modalDescription('Attachments zijn toevoegingen aan je product. Denk hierbij aan sloten, bekleden met stof of ander materiaal/opties die je aan de kist zou kunnen toevoegen. Heb je vragen over attachments? Bel ons dan op.')
                    ->modalIcon('heroicon-o-link')
                    ->modalSubmitActionLabel('Toevoegen')
                    ->form(
                        AttachmentRelationResources::getAttachmentRepeaterForm()
                    )
                    ->hidden(fn($livewire) => in_array($livewire->ownerRecord->status->name, ['ACCEPTED', 'PRODUCTION', 'TO_INVOICE', 'INVOICED', 'CANCELLED']))
                    ->slideOver()
])
Was this page helpful?