© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
15 replies
gladjanus43

Repeater inside a relationship manager action

I am trying to implement a repeater inside of a modal form within a relationship manager for products.
My relationship structure is as follows:
Order -> Product -> Attachment -> RevenueLine.

I am trying to add the action to the ProductRelationManager so I can have a link inside the table of products in the order to add new attachments instead of opening the product edit page.

The repeater is nicely shown, and I can create new database records through this repeater

However after I clicked save and reopen the dialog it does not show the data. I can see in the docs that I need to fill the form but how can this be done for the repeater field? Also when I add a new attachment after I created the first few, it tries to delete all the attachments and then reinsert. This is not possible for my structure because every attachment has a relationship with revenueLines so it returns a foreign key constraint error
Screenshot_2023-12-15_at_11.48.59.png
Screenshot_2023-12-15_at_11.56.28.png
Solution
I found it, you indeed need to fill the form with the relationship data manually:
Action::make('attachments')
  ->icon('heroicon-o-link')
  ->fillForm(fn (Product $record): array => [
      'attachments' => $record->attachments
  ])
  ->form([
      Repeater::make('attachments')
          ->relationship('attachments')
          ->schema([
              FORM ELEMENTS
          ])
  ])
Action::make('attachments')
  ->icon('heroicon-o-link')
  ->fillForm(fn (Product $record): array => [
      'attachments' => $record->attachments
  ])
  ->form([
      Repeater::make('attachments')
          ->relationship('attachments')
          ->schema([
              FORM ELEMENTS
          ])
  ])
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

Importer action inside relationship
FilamentFFilament / ❓┊help
16mo ago
Repeater ->relationship() inside multiple Group ->relationship() in a form issue
FilamentFFilament / ❓┊help
4mo ago
Refresh infolist repeater containing a relationship on action
FilamentFFilament / ❓┊help
8mo ago
Action `fillForm` not working inside Repeater
FilamentFFilament / ❓┊help
6mo ago