I use Laravel Nova. On a resource I have an Action. The fields
method returns a BooleanGroup
Field:
return [
BooleanGroup::make('Tagss')->options(
[
'one',
'two',
'three',
'four'
]
),
];
Result:
I don't know how to pre-check checkboxes. Let's say 'two' should be checked when the modal loads, how to do this?
CodePudding user response:
Use default function. Set true
for the default value
return [
BooleanGroup::make('Tags')->options(
[
'one',
'two',
'three',
'four'
]
)->default(function ($request) {
return [
'one' => false,
'two' => true,
'three' => false,
'four' => false,
];
}),
];