It stores all your laravel settings in database and provides a simple api to work with those settings. It also type cast your values into the specified format.
You can install the package via composer:
composer require scriptingbeating/laravel-global-settings
Publish the migration:
php artisan vendor:publish --provider="ScriptingBeating\GlobalSetting\GlobalSettingServiceProvider" --tag="migrations"
Run your migrations:
php artisan migrate
You will get a table global_settings
in your database which mainly three columns
key
to store setting name, value
to store setting value and type
in which value should be type casted.
Supported Casting Type:
string
int or integer
bool or boolean
array
object
global_setting()->all();
global_setting($key); // global_setting('app_name');
global_setting()->get($key, $default = null);
global_setting()->set($key, $value);
global_setting()->set($key, $value, $type = 'string');
global_setting()->has($key);
global_setting()->remove($key);
Or You can also use GlobalSetting
Facade.
GlobalSetting::all();
GlobalSetting::get($key, $default = null);
GlobalSetting::set($key, $value);
GlobalSetting::set($key, $value, $type = 'string');
GlobalSetting::has($key);
GlobalSetting::remove($key);
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.