Fork me on GitHub

Persistent settings

The Persistent Settings mechanism allows for the easy editing of configuration options using the built-in interface. A distinction is made between the configuration options accessible using the Config class and the settings accessible through the Settings class. When a setting such as the WALLED-GARDEN.ENABLED is requested, the system will first try to return the matching setting, then, if it cannot be found, revert to looking up the same configuration option.

Initially, the application does not have any settings. The settings can be generated from the Settings Administration page in the Admin menu by clicking on the "Load settings" button. This will read the .env file and create a setting with its value for each valid entry. A setting can also be manually created from the Settings Administration page if the proper name to use is known. The names to use are the keys used by the configuration and can be located in the config directory. Once a setting is defined, it's value will take precedence over the value held in the configuration files or environment.

Additionally, settings can be encrypted, via the Web admin interface or the Artisan commands (see below). The Setting::Get(...) method will automatically decrypt any encrypted value before returning it.

to help manage the settings, 4 commands are available via Artisan. These 4 commands are setting:all, setting:forget, setting:get & setting:set.

  • The setting:get command will retrieve the setting, decrypt it if required and output it.
  • The setting:all command will output all settings in raw & encrypted form, it is useful to dump all settings into a .env as a backup or to create another instance of the application.
  • The setting:set command allows the creation of settings in encrypted or unencrypted form. If a value is not provided it will be requested. Additionally, if the value is to be encrypted, when it is requested, it will not echo on the screen.
  • Finally, the setting:forget command allows the removal of any setting or group of settings.