Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble to understand how to update settings #11

Closed
Drillan767 opened this issue Nov 26, 2020 · 2 comments
Closed

Trouble to understand how to update settings #11

Drillan767 opened this issue Nov 26, 2020 · 2 comments

Comments

@Drillan767
Copy link

Hello,

I've just installed this library in my project, I want to use it to store details such as social networks, but also pieces of configuration such as "should we allow users to register on the website?"

However, when I read the documentation, it looks like I need to "hardcode" my settings, then migrate them. I'm pretty sure I'm missing something. Is it possible to edit the settings from a form in my website, and if so, how should I proceed?

@rubenvanassche
Copy link
Member

Hi @Drillan767,

It is indeed true you have to hardcode your settings like a boolean for: "should we allow users to register on the website?". Migrating will add these settings (and in this case the boolean) to the database/redis. You can now inject your settings class everywhere in Laravel and it will have a value for the boolean.

When you want to update the value of this boolean then you should update the value of the boolean in the settings class and call the save method on it. The package will update the database/redis then with the new value of the boolean.

Does that make sense?

@Drillan767
Copy link
Author

Hello again, thank you for the explaination, I realized I overlooked the "update" part, and it (of course) works as a charm. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants