© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
Remi

Repeater BelongsToMany not working on edit form

i followed the steps from the docs: https://filamentphp.com/docs/3.x/forms/fields/repeater#integrating-with-a-belongstomany-eloquent-relationship

This works on creation, but on the edit form it only shows a single record, not all the items.

On the Client Resource:

             Forms\Components\Repeater::make('clientLocations')
                    ->relationship()
                    ->simple(
                        Forms\Components\Select::make('location_id')
                            ->relationship('location', 'name')
                            ->required()
                    )
                    ->columns(1),
             Forms\Components\Repeater::make('clientLocations')
                    ->relationship()
                    ->simple(
                        Forms\Components\Select::make('location_id')
                            ->relationship('location', 'name')
                            ->required()
                    )
                    ->columns(1),


ClientLocation Pivot model has:
    public function client(): BelongsTo
    {
        return $this->belongsTo(Client::class);
    }

    public function location(): BelongsTo
    {
        return $this->belongsTo(Location::class);
    }
    public function client(): BelongsTo
    {
        return $this->belongsTo(Client::class);
    }

    public function location(): BelongsTo
    {
        return $this->belongsTo(Location::class);
    }


Also when I submit the edit page and change the single record it shows, it gives an error:
update
  `client_location`
SET
  `location_id` = 3
WHERE
  `` = 39
  AND `` = 39
update
  `client_location`
SET
  `location_id` = 3
WHERE
  `` = 39
  AND `` = 39
Repeater - Form Builder - Filament
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

Testing edit form with repeater
FilamentFFilament / ❓┊help
2y ago
Repeater belongsToMany pivot - empty
FilamentFFilament / ❓┊help
15mo ago