© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•12mo ago•
6 replies
Aivirth

Weird behavior in nested repeater relationship

I noticed a weird side effect while trying to create a nested relationship with repeaters.
When i add items to the relationship
promo
promo
everything works correctly but as soon as the form fills again after submit it only shows 1 element. Refreshing the page shows the correct number of elements.
postpromopreset
postpromopreset
is defined as a HasMany relationship on the
Post
Post
model
postpromopreset_promo
postpromopreset_promo
is defined as a HasMany relationship on the
Postpromopreset
Postpromopreset
model to a pivot model called
PostpromopresetPromo
PostpromopresetPromo

I know the names are confusing but i'm still prototyping the entire thing, the idea is to create a series of preset of promos which then i can use inside the Post model in a select

Repeater::make('Promos')
  ->relationship(name: 'postpromopreset' )
  ->label('Presets')
  ->schema([
      TextInput::make('name')
          ->label(__('Name')),
      Repeater::make('promotions')
          ->label('Promo')
          ->relationship(name:'postpromopreset_promo')
          ->reorderable()
          ->reorderableWithDragAndDrop()
          ->reorderableWithButtons()
          ->orderColumn('order_column')
          ->schema([
              Select::make('promo_id')
                  ->relationship(
                      name:'promo',
                      titleAttribute:'title'
                  )
                  ->disableOptionsWhenSelectedInSiblingRepeaterItems()

          ])
          ->grid(4)

  ])
Repeater::make('Promos')
  ->relationship(name: 'postpromopreset' )
  ->label('Presets')
  ->schema([
      TextInput::make('name')
          ->label(__('Name')),
      Repeater::make('promotions')
          ->label('Promo')
          ->relationship(name:'postpromopreset_promo')
          ->reorderable()
          ->reorderableWithDragAndDrop()
          ->reorderableWithButtons()
          ->orderColumn('order_column')
          ->schema([
              Select::make('promo_id')
                  ->relationship(
                      name:'promo',
                      titleAttribute:'title'
                  )
                  ->disableOptionsWhenSelectedInSiblingRepeaterItems()

          ])
          ->grid(4)

  ])
Solution
Update: I found out the issue was caused by me extending from
Illuminate\Database\Eloquent\Relations\Pivot
Illuminate\Database\Eloquent\Relations\Pivot
instead of
Illuminate\Database\Eloquent\Model
Illuminate\Database\Eloquent\Model
which caused this weird behavior
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

weird select option behavior on relationship
FilamentFFilament / ❓┊help
2y ago
BelongsToMany relationship in Repeater
FilamentFFilament / ❓┊help
3y ago
Nested Repeater
FilamentFFilament / ❓┊help
2y ago
Slow select relationship in a relationship repeater
FilamentFFilament / ❓┊help
2y ago