Looking to hire Laravel developers? Try LaraJobs

laravel-settings maintained by muetzeofficial

Description
Global settings loaded from the database
Last update
2019/12/17 13:28 (dev-master)
License
Downloads
12

Comments
comments powered by Disqus

Created for Laravel 6

Install

composer require muetzeofficial/laravel-settings

Publish

php artisan vendor:publish --provider="MuetzeOfficial\Settings\SettingsServiceProvider"

Migrate

php artisan migrate

Usage

With the setting() helper, we can get and set options:

// Get setting
setting('someKey');

// Set setting
setting(['someKey' => 'someValue']);

// Check the option exists
setting_exists('someKey');

If you want to check if an option exists, you can use the facade:

use MuetzeOfficial\Settings\SettingFacade as Setting;

Setting::set(['someKey'=>'someValue']);

Setting::set([
    'someKey'=>'someValue',
    'anotherKey'=>'anotherValue',
]);

Setting::get('someKey');

Blade

@setting('someKey')

Console

It is also possible to set options within the console:

php artisan setting:set {someKey} {someValue}