This package allows you to save the configuration in a more persistent way. Use the database to save your settings, you can save values in json format. You can also override the Laravel configuration.
Run the following command:
composer require byancode/settings
Register the service provider in config/app.php
Byancode\Settings\Provider::class,
Add alias if you want to use the facade.
'Setting' => Byancode\Settings\Facade::class,
Publish config file.
php artisan vendor:publish --provider="Byancode\Settings\Provider"
You can change the options of your app from config/settings.php
file
You can either use the helper method like settings('foo')
or the facade Settings::get('foo')
# GETTER
Settings::get('foo');
Settings::get('foo.bar');
Settings::get('foo__bar');
# SETTER
Settings::set('foo', ['bar' => 'test']);
Settings::set('foo.bar', 'test');
$settings = settings();
# GETTER
settings('foo');
$settings->foo;
settings('foo.bar');
$settings->foo__bar;
$settings->get('foo.bar');
# SETTER
settings('foo', ['bar' => 'test']);
$settings->foo = ['bar' => 'test'];
$settings->foo__bar = 'test';
$settings->set('foo.bar', 'test');
You can get the settings directly in your blade templates using the helper method or the blade directive like @settings('foo')