MilenKo
Explore posts from serversSpatie Settings Checkboxlist
Wholly guaccamole... It was my silly mistake of trying to define the input form field as an array, e.g.
Must be one of all my attempts to please the array data storing... Once I removed it, I CONFIRM YOUR CODE WORKS !!!
Thank you @awcodes you saved me a few more weeks of scratching my head...
27 replies
How to order naviation groups
I've moved out by setting a group icon and having sub menu items not having one as it makes more sense for my current project needs. By design filament allows either to have icon on the group but not on the items inside the group, or not to group the items and have an icon for any of the items on their own...
It is what it is, I am not keen on modifying the filament code as I will have to deal with updates later and it will be a hassle, so for me this topic is closed now... 😉 (having other issues to tackle 😉 )
14 replies
Spatie Settings Checkboxlist
@awcodes
Well, i would expect it to work as well, however there is an error the minute I switch to array type as it tries to store a string as an array and it does not allow it. I've posted it in the initial comment that switching string to array did not do the work.
Here is the error from my previous message:
I've tried also to switch the type of the checkbox as a collection, however it seems like a method like ->collection() does not exist on the form inputs...
Seems like the data passed is a JSON object of type:
[
'1' => 'true',
'2' => 'false'
]
Or some other data sorting, but this should have been considered as a string, but it is actually considered as something strange to me, as I cannot define $site_checkboxlist as array, nor as string...
Maybe I should try defining it as a JSON object somehow to test, but I don't find any useful information so far about that in the casts, and i've looked into many LaravelSettings casts to figure out which one should i use and how...
27 replies
Spatie Settings Checkboxlist
Tried to add this cast, but it was able to show the Settings page, but blew an error on storing the data:
`php
public static function casts(): array
{
return [
'site_checkboxlist' => \Spatie\LaravelSettings\SettingsCasts\CollectionCast::class,
];
}
27 replies
Spatie Settings Checkboxlist
The idea is to add an example for all Form inputs so that if anybody needs to combine settings, can simply repurpose the template as they see fit without wondering like me how to add this or that or have the error I am facing with array<>string store.
27 replies
Spatie Settings Checkboxlist
@awcodes
Here it is the repo with all it's perks.
FYI, so far i only have installed a fresh Filament Admin panel with Laravel 11.x and added Larael Jetstream to improve the user logging experience adding 2FA.
On top of that I've installed Filament Spatie Settings plugin and created the shared GeneralSettings.php extending Settings and GeneralSettingsPage.php responsible for the Settings form.
Here is the github repo URL;
https://github.com/mikemastercorp/filament-starter-kit
27 replies
Spatie Settings Checkboxlist
Steps to reproduce my "issue":
1. Install filament (I used latest from few days ago)
2. Install Spatie-Settings for filament.
3. Create a migration
4. Create a GeneralSettings settings page that extends the Settings class
5. Create the GeneralSettingsPage in filament/pages to show it to the navigation and inside of this page, try to use CheckboxList with the following code (or similar)
6. Try to store a few checkboxes
`php
// 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
27 replies
Spatie Settings Checkboxlist
@awcodes
Ive read it inside out but I am not really finding any clue as to what type of cast to use for storing an array of data to a single column...
The only close example to my need was:
However in this example it is using the encrypted() method to encrypt the 'site_name' data
27 replies
Trouble with Attach (Detach works)
I mean dd the output you should get from the specific column and see if it even returns a value. Another thing can be if the model does not have the rifht to store the object data (guarder or filable properties are not set on the model)
53 replies
Trouble with Attach (Detach works)
From what I know, Filament is smart enough to know the input field based on the column relation of the make() method, so if any record is stored in the DB matching the column name, filament should set it as a default and pre-populate as a selected option. That is why I aggree with @awcodes that there is something fishy with your relations... Check your relations using dd() or \Log()
53 replies
Help with Builder - no JSON
I am not an expert in Filament to be honest but I think you've answered your question already with your latest statement as the builder uses the input name you defined in the static make() method. There has to be a way to manipulate maybe that, but for me this will be a high end acrobatics that I cannot assist much with (or not yet as I am just trying to go along with Filament and all it's magic tricks and abilities under the hood)
5 replies