Check if value is true, and check the checkbox on update

I have a multi tenancy setup. But when i want to edit an tenancy I want to have all checkboxes checked if they are true in the json object from the database.
How can I do this?

CheckboxList::make('settings')
    ->options([
        'twitter' => 'Twitter',
        'linkedin' => 'LinkedIn',
        'whatsapp' => 'WhatsApp',
        'email' => 'Email',
        'copy' => 'Copy',
    ])
    ->descriptions([
        'twitter' => 'Enable sharing on Twitter (x)',
        'linkedin' => 'Enable sharing on LinkedIn',
        'whatsapp' => 'Enable sharing on WhatsApp',
        'email' => 'Enable sharing on Email',
        'copy' => 'Enable sharing through coping the link',
    ])


{
    "copy": false,
    "email": false,
    "twitter": true,
    "linkedin": false,
    "whatsapp": false
}


So if in this example twitter is true, then I want to have the checkbox for twitter checked. Is this possible?
Was this page helpful?