scriptingbeating/laravel-global-settings

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.

1.0 2020-08-31 19:18 UTC

This package is auto-updated.

Last update: 2024-08-29 05:13:07 UTC


README

Latest Version on Packagist Software License

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.

Installation

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

Usage

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);

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email mohansharma201.ms@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.