© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•17mo ago•
26 replies
MilenKo

Spatie Settings Checkboxlist

Hello all. As part of my steep learning curve, I've decided to build a new Filament Startup Kit adding some interesting features which might be useful for any DEV to use as a starter.

So after setting up Filament Admin Panel with Jetstream to allow 2FA, it was time for Spatie Settings which would allow any project to have an easy to implement/edit/adapt Settings page. To mimic the appearance of other settings pages we are used to (e.g. Wordpress etc). I've decided to use a single group, so added a few input variables in /app/Settings/GeneralSettings.php and then added the GeneralSettingsPage.php which would hold the input forms to store the data. Also added a migration to supply the required columns.

To separate/group some settings logically I decided to use tabs which are easy to implement and allow the required functionality. So with that I decided that it will be great to add an example for every Form input there is with Filament and it all worked perfectly fine to store and show the stored data on the Settings page utntil I reached the CheckboxList input.

So I am presently able to show the form as it should using the following code:

// All CheckboxList options: https://filamentphp.com/docs/3.x/forms/fields/checkbox-list
CheckboxList::make('site_checkboxlist') // checkbox list with supplied options
    ->options([
        '1' => '== A ==',
        '2' => '== B ==',
        '3' => '== C =='
    ])
    // set the number of columns to order the list options (equal number of coluns and choices makes them horizonta)
    ->columns(3),
    // ->label('') // set an empty label value to hide it
// All CheckboxList options: https://filamentphp.com/docs/3.x/forms/fields/checkbox-list
CheckboxList::make('site_checkboxlist') // checkbox list with supplied options
    ->options([
        '1' => '== A ==',
        '2' => '== B ==',
        '3' => '== C =='
    ])
    // set the number of columns to order the list options (equal number of coluns and choices makes them horizonta)
    ->columns(3),
    // ->label('') // set an empty label value to hide it


However when I define the variable in the GeneralSettings.php file as: public ?string $site_checkboxlist I get an error while trying to store the data:
`
Cannot assign array to property App\Settings\GeneralSettings::$site_checkboxlist of type ?string 
`
Cannot assign array to property App\Settings\GeneralSettings::$site_checkboxlist of type ?string 
image.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Spatie Settings
FilamentFFilament / ❓┊help
2y ago
Spatie Translatable with spatie laravel settings
FilamentFFilament / ❓┊help
15mo ago
Spatie settings not working
FilamentFFilament / ❓┊help
3y ago
Global Search With Spatie Settings
FilamentFFilament / ❓┊help
3y ago