muetzeofficial/laravel-settings

This package is abandoned and no longer maintained. No replacement package was suggested.

Global settings loaded from the database

1.0 2019-12-17 10:29 UTC

This package is not auto-updated.

Last update: 2021-06-02 14:46:16 UTC


README

68747470733a2f2f7265732e636c6f7564696e6172792e636f6d2f6474666276766b79702f696d6167652f75706c6f61642f76313536363333313337372f6c61726176656c2d6c6f676f6c6f636b75702d636d796b2d7265642e737667

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}