Getting Null for Multi-Select in Custom Page

I have created a custom page where I have form inputs:
public function form(Form $form): Form
{
return $form
->schema([
Section::make('Push a Notification to Firebase')
->schema([
Forms\Components\Select::make('topics')
->multiple()
->options(FcmTopic::class),
Forms\Components\TextInput::make('title')->required(),
Forms\Components\Textarea::make('message')->required(),
Forms\Components\TextInput::make('image_url')->required(),
Forms\Components\TextInput::make('content_url')->required(),
]),
])
->statePath('data');
}
public function form(Form $form): Form
{
return $form
->schema([
Section::make('Push a Notification to Firebase')
->schema([
Forms\Components\Select::make('topics')
->multiple()
->options(FcmTopic::class),
Forms\Components\TextInput::make('title')->required(),
Forms\Components\Textarea::make('message')->required(),
Forms\Components\TextInput::make('image_url')->required(),
Forms\Components\TextInput::make('content_url')->required(),
]),
])
->statePath('data');
}
I don't need any model to store these values. and when I submit, I get all the values except multiple select and it's always return null. But without ->multiple() it works fine. What is the issue here?
1 Reply
krekas
krekas6mo ago
options should be an array
Want results from more Discord servers?
Add your server