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',

      ])


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.
Was this page helpful?