F
Filament7mo ago
adnn

different getOptionLabelFromRecordUsing for selected items?

Forms\Components\Select::make('website')
->live()
->label('Brand')
// ->required()

->multiple()
->relationship('website', 'name')
->allowHtml()
->getOptionLabelFromRecordUsing(fn (Website $record) =>
"<span class='font-semibold text-md'>{$record->name}</span> <br/>
<span class='text-xs font-light'>{$record->id}&nbsp;{$record->domain}</span>"

)

->searchable(['name', 'domain'])
->preload(),
Forms\Components\Select::make('website')
->live()
->label('Brand')
// ->required()

->multiple()
->relationship('website', 'name')
->allowHtml()
->getOptionLabelFromRecordUsing(fn (Website $record) =>
"<span class='font-semibold text-md'>{$record->name}</span> <br/>
<span class='text-xs font-light'>{$record->id}&nbsp;{$record->domain}</span>"

)

->searchable(['name', 'domain'])
->preload(),
Is it possible to have different html for the currently selected item? For example to only show the name on the Selected item, but show other things when searching items
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server