Checkbox list

I am looking to provide default for a form with Checkbox list. I want two of them to be checked by default and two of them to be unchecked. The code
CheckboxList::make('optional_courses')
->options([
'PROB03' => 'Advanced Probability',

'ANA03' => 'Advanced Analysis',

'ER01' => 'Ergodic Theory',

'DS01' => 'Descriptive Set Theory',

])
CheckboxList::make('optional_courses')
->options([
'PROB03' => 'Advanced Probability',

'ANA03' => 'Advanced Analysis',

'ER01' => 'Ergodic Theory',

'DS01' => 'Descriptive Set Theory',

])
I want first two to be checked by default and other two are unchecked. Although I have hard coded it, these options are coming from some other table, where the first two are recommended. Thanks in advance for any help.
2 Replies
Dan Harrin
Dan Harrin2y ago
->default(['PROB03', 'ANA03']) ?
Anish
AnishOP2y ago
How silly of me. I should have tried it. Thanks.
Want results from more Discord servers?
Add your server