Seeding settings
On a fresh DB after a
migrate:fresh --seed
calling TwillAppSettings::get
gives me a Illuminate\Support\ItemNotFoundException
error. I was hoping to seed them via a migration or seeder or set default values but can't see anything obvious to do so in the docs.10 Replies
For context the specific settings field I'm getting that gives me that error is a browser multi-select
Hi @ifox just tagging since I haven't had a response. Maybe I should have put this in #❓questions like last time
I have gotten around this with a wrapper class but feels hacky to need to do this:
Hi @RacoonMittens you're right, there should be a seeder for settings. If you go to the CMS settings, they are seeded, but not before that. I also think we should implement get like you did. We'll revisit this.
Is there a simple way to use that seeder? I looked around but didn't find anything that stood out
For now my wrapper is working like a charm so I'm happy either way
GitHub
twill/src/Services/Settings/SettingsGroup.php at f365a13e4929ba90bb...
Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/c...
GitHub
twill/src/Http/Controllers/Admin/AppSettingsController.php at f365a...
Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/c...
Ah thats really helpful. So in that case, I can just put this block in my AppServiceProvider boot function to make sure they exist before I try to use them anywhere
thanks for the help
oh actually that boot block doesn't work 🤔
Think I'll just stick with my custom facade wrapper for now
I think we're talking about 2 different issues. Your settings are already booted, but retrieving a browser field is failing if it's empty? Even if you save the settings form with an empty browser?
If I save the form with an empty browser it works fine, but up until that point I get errors from retrieving that setting
ok yeah, makes sense
My issue is that I am trying to check this setting in a generic page middleware that populates some nav elements
so I can't get to the settings page (without commenting out a block of code in the middleware) to even save the blank version