FilamentF
Filament16mo ago
core

pivotData issue

what am I missing i get this error? Method Filament\Forms\Components\Select::pivotData does not exist.
Forms\Components\Select::make('Diets')
->relationship(name: 'diets', titleAttribute: 'name')
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->name}")
  ->multiple()
  ->pivotData([
'is_suitable' => true,
]),
//recipe model
{
   return $this->belongsToMany(Diet::class, 'diet_recipe')
            ->withPivot('is_suitable')
            ->withTimestamps();

}
Was this page helpful?