© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
10 replies
ROOT-LEE

Storing repeater data in a pivot table

Hi ,ho to save data from repeater into pivot table?
Here's the Models and the table I have.
----
Tables:
expert :id, first_name,last_name,...
diplome :id name,...
diplome_experts : id,diplome_id,expert_id,year,...

Expert Model :
 public function diplome_expert(): BelongsToMany
    {
        return $this->belongsToMany(Diplome::class)
            ->withPivot('year', 'specialite_id', 'etablissement_id')
            ->withTimestamps();
    }
 public function diplome_expert(): BelongsToMany
    {
        return $this->belongsToMany(Diplome::class)
            ->withPivot('year', 'specialite_id', 'etablissement_id')
            ->withTimestamps();
    }


Expert (Livewire)
Forms\Components\Section::make('Diplômes universitaires obtenus')                ->schema([                        Forms\Components\Repeater::make('diplome_expert')->label('Diplômes universitaires obtenus')                                      
->relationship()
->schema([                                     Forms\Components\Select::make('diplome_id')->options(fn() => Diplome::pluck('name_fr', 'id')->toArray())->searchable()->label('Diplome'),
                                        Forms\Components\TextInput::make('year')->label('Année'),

Forms\Components\Select::make('specialite_id')->options(fn() => Specialite::pluck('name_fr', 'id')->toArray())->searchable()->label('Spécialité'),
  Forms\Components\Select::make('etablissement_id')->options(fn() => Etablissement::pluck('libelle_fr', 'id')->toArray())->searchable()->label('Etablissement'),

])->defaultItems(1)->createItemButtonLabel('Ajouter un autre dilpome universitaitre')->columns(2)->collapsible()->required(),
     ])->collapsed(),

]),
Forms\Components\Section::make('Diplômes universitaires obtenus')                ->schema([                        Forms\Components\Repeater::make('diplome_expert')->label('Diplômes universitaires obtenus')                                      
->relationship()
->schema([                                     Forms\Components\Select::make('diplome_id')->options(fn() => Diplome::pluck('name_fr', 'id')->toArray())->searchable()->label('Diplome'),
                                        Forms\Components\TextInput::make('year')->label('Année'),

Forms\Components\Select::make('specialite_id')->options(fn() => Specialite::pluck('name_fr', 'id')->toArray())->searchable()->label('Spécialité'),
  Forms\Components\Select::make('etablissement_id')->options(fn() => Etablissement::pluck('libelle_fr', 'id')->toArray())->searchable()->label('Etablissement'),

])->defaultItems(1)->createItemButtonLabel('Ajouter un autre dilpome universitaitre')->columns(2)->collapsible()->required(),
     ])->collapsed(),

]),


Error captured :
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'diplome_id' in 'field list' (Connection: mysql, SQL: insert into
**diplomes**
**diplomes**
(
diplome_id
diplome_id
,
year
year
,
specialite_id
specialite_id
,
etablissement_id
etablissement_id
,
updated_at
updated_at
,
created_at
created_at
)

------------
The data going to be stored in the 'diplome' table and not in the 'diplome_ experts' pivot table?
Any help , Thanks
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

save repeater data in pivot table
FilamentFFilament / ❓┊help
2y ago
Repeater with pivot table
FilamentFFilament / ❓┊help
11mo ago
Repeater and pivot table
FilamentFFilament / ❓┊help
3y ago
Insert Data in Pivot Table
FilamentFFilament / ❓┊help
3y ago