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();
    }


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(),

]),


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

------------
The data going to be stored in the 'diplome' table and not in the 'diplome_ experts' pivot table?
Any help , Thanks
Was this page helpful?