olivier_oursblanc
Multi-select in relationship doesn't display values on edit
I try but it's not working better
The code in the ressource :
Forms\Components\Select::make('packages')
->label(__('smartxsp::campaign.edit-packages'))
->helperText(__('smartxsp::campaign.edit-packages-help'))
->multiple()
->relationship(
name: 'packages',
titleAttribute: 'name',
modifyQueryUsing: fn (Builder $query) => Package::allowed(),
)
->getOptionLabelFromRecordUsing(fn (Package $record) => "{$record->name}")
->searchable(['name'])
->forceSearchCaseInsensitive()
->columnSpan("full")
->preload()
,
And in Eloquent model :
public function packages()
{
return $this->belongsToMany(\SmartXSP\Brain\Models\Package::class)->wherePivot('exclude', 0)->withPivot('exclude');
}
11 replies