Save values of Select in variable

How can I save the values of a MultiSelect in a variable and use it in another Multiselect? I tried with $set but I dont know how to get the $get function inside an options function of a multiselect. After that I tried to save it via afterStateUpdated in a variable but I cant use $this inside an options function of a multiselect.
1 Reply
GeRaged | Niklas
GeRaged | NiklasOP15mo ago
Section::make('Suche')
->schema([
Select::make('group')
->label('Gruppe')
->options(Attribute::select('group')->distinct()->get()->map(fn ($value) => $value['group']))
->searchable()
->afterStateUpdated(function ($state, callable $get, callable $set) {
$set('selected', $state);
})
]),
Section::make('Attribute')
->schema(
$data->map(fn ($attributes, $group) =>
CheckboxList::make($group)
->options($attributes)
->visible(/* I want to only show the attributes, when the group is selected | When no group is selected everything should be visible*/)
)->toArray()
)
->columns(3)
Section::make('Suche')
->schema([
Select::make('group')
->label('Gruppe')
->options(Attribute::select('group')->distinct()->get()->map(fn ($value) => $value['group']))
->searchable()
->afterStateUpdated(function ($state, callable $get, callable $set) {
$set('selected', $state);
})
]),
Section::make('Attribute')
->schema(
$data->map(fn ($attributes, $group) =>
CheckboxList::make($group)
->options($attributes)
->visible(/* I want to only show the attributes, when the group is selected | When no group is selected everything should be visible*/)
)->toArray()
)
->columns(3)
Want results from more Discord servers?
Add your server