Best Practices

Overriding Config

{note} You're browsing the documentation for an old version of laravel-settings. Consider upgrading your project to v3. Check your version with the following command:

composer show rawilk/laravel-settings

A common scenario you may run into is overriding a config value from a setting value you have stored in the database. The best place to do this would be in the boot() method in a service provider, however you could also override the value before your application references the config value.

public function boot()
    config(['app.timezone' => Settings::get('app.timezone', 'UTC')]);

You can store the settings you are using to override config values with any keys you want, but for clarity you should store them as the same key that is used in the config.

Performance Tips
Caught a mistake? Suggest an edit on GitHub