F
Filament3mo 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();

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

}
2 Replies
LeandroFerreira
LeandroFerreira3mo ago
did you try to update the Filament version?
core
coreOP3mo ago
doing it now I see that it is missing ok I upgraded but the ->pivotData([ 'is_suitable' => true, ]), is not working: debugbar:select distinct diets.* from diets left join diet_recipe on diets.id = diet_recipe.diet_id where diets.id in ('1', '2', '3', '4', '5') ok works now I do not get all the options in the preload from the diet_recipe table
Want results from more Discord servers?
Add your server