multiple() is not working in form select
I have a Select::make('salesperson') on my form and its works fine If I use options but when I use multiple with it, it does not show anything in the search bar saying no results found
My code
I also tested it with below code shows same issue
My code
Select::make('salesperson')
->multiple()
->options($this->options)
->disablePlaceholderSelection()
->live(),Select::make('salesperson')
->multiple()
->options($this->options)
->disablePlaceholderSelection()
->live(),I also tested it with below code shows same issue
Select::make('salesperson')
->multiple()
->options([
'draft' => 'Draft',
'reviewing' => 'Reviewing',
'published' => 'Published',
])Select::make('salesperson')
->multiple()
->options([
'draft' => 'Draft',
'reviewing' => 'Reviewing',
'published' => 'Published',
])Solution
It should be
public ?array $data = [];
public function mount(): void
{
$this->form->fill([
'start' => now()->subDays(7)->format('Y-m-d'),
'end' => now()->format('Y-m-d'),
'salesperson' => null,
]);
}
public function form(Form $form): Form
{
return $form
->schema([
Grid::make(3)->schema([
DatePicker::make('start'),
DatePicker::make('end'),
Select::make('salesperson')
->options(fn () => User::orderBy('created_at', 'desc')->pluck('name', 'id'))
->multiple()
->searchable()
->selectablePlaceholder(),
]),
])
->statePath('data');
}public ?array $data = [];
public function mount(): void
{
$this->form->fill([
'start' => now()->subDays(7)->format('Y-m-d'),
'end' => now()->format('Y-m-d'),
'salesperson' => null,
]);
}
public function form(Form $form): Form
{
return $form
->schema([
Grid::make(3)->schema([
DatePicker::make('start'),
DatePicker::make('end'),
Select::make('salesperson')
->options(fn () => User::orderBy('created_at', 'desc')->pluck('name', 'id'))
->multiple()
->searchable()
->selectablePlaceholder(),
]),
])
->statePath('data');
}