How to load the json column data as a checkboxList

I have a json column named cpts and it has following json values
[
{ "code": "99223", "description": "INITIAL HOSPITAL CARE" },
{ "code": "99222", "description": "HOSPITAL ADMIT DIRECT" }
]
[
{ "code": "99223", "description": "INITIAL HOSPITAL CARE" },
{ "code": "99222", "description": "HOSPITAL ADMIT DIRECT" }
]
I want to populate the checkboxlist and the checkbox has to be checked and while saving, it has to save in above format itself. So far my code as below
\Filament\Forms\Components\CheckboxList::make('cpts')
->options(function (callable $get) {
$cpt_options = [];
foreach($get('cpts') as $cpt) {
$cpt_options[] = $cpt['code'] . ' - ' . $cpt['description'];
}
return $cpt_options;
})
\Filament\Forms\Components\CheckboxList::make('cpts')
->options(function (callable $get) {
$cpt_options = [];
foreach($get('cpts') as $cpt) {
$cpt_options[] = $cpt['code'] . ' - ' . $cpt['description'];
}
return $cpt_options;
})
Can someone help on this ?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server