© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
6 replies
marcf

Nested Repeater

Is it possible to have nested repeaters but specify the relationship of the nested one to be on the parent model?

I have three tables: evenement, film, and seance, along with their respective pivot tables and models. I'm following the documentation for integrating with a BelongsToMany relationship from the Filament PHP Repeater Documentation.

Here is my code:

Repeater::make('evenementFilms')
    ->relationship()
    ->schema([
        Select::make('film_id')
            ->label("Film")
            ->options(Film::pluck('titre', 'id'))
            ->searchable()
            ->live(),
        Repeater::make('evenementSeances')
            // ->model(Evenement::class)
            ->label("Séances liés à cet Événement.")
            ->relationship('evenementSeances')
            ->schema([
                Select::make('seance_id')
                    ->label("Séance")
                    ->options(Seance::pluck('debut', 'id'))
                    ->searchable()
                    ->live(),
            ]),
    ]),
Repeater::make('evenementFilms')
    ->relationship()
    ->schema([
        Select::make('film_id')
            ->label("Film")
            ->options(Film::pluck('titre', 'id'))
            ->searchable()
            ->live(),
        Repeater::make('evenementSeances')
            // ->model(Evenement::class)
            ->label("Séances liés à cet Événement.")
            ->relationship('evenementSeances')
            ->schema([
                Select::make('seance_id')
                    ->label("Séance")
                    ->options(Seance::pluck('debut', 'id'))
                    ->searchable()
                    ->live(),
            ]),
    ]),


In this setup, the nested repeater evenementSeances defaults to the pivot model (EvenementFilm) instead of the parent model (Evenement). If I uncomment the model specification (->model(Evenement::class)), the relationship does not save correctly.

My goal is for the user to first choose a film, and then, if they want, choose sessions for each selected film. How can I correctly specify the relationship for the nested repeater to be on the parent model?

Regards
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

nested repeater extraItemActions
FilamentFFilament / ❓┊help
17mo ago
nested repeater n+1 query
FilamentFFilament / ❓┊help
3mo ago
Nested repeater not maintaining order
FilamentFFilament / ❓┊help
2y ago
Query optimization for nested repeater
FilamentFFilament / ❓┊help
2y ago