PHP code example of ferri / laravel-settings

1. Go to this page and download the library: Download ferri/laravel-settings library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ferri / laravel-settings example snippets


'cache' => false,

Settings::set('key', 'value');
Settings::set('keyArray', ['arrayKey' => 'arrayValue']);

Settings::get('key'); // value
Settings::get('keyArray'); // ['arrayKey' => 'arrayValue']
Settings::get('keyNotExists', 'default'); // default

Settings::has('key'); // true
Settings::has('keyNotExists'); // false

Settings::forget('key');

Settings::truncate();

Settings::setExtraColumns(['tenant_id' => 1])->set('site_title', 'Awesome Blog');
Settings::setExtraColumns(['tenant_id' => 1])->get('site_title'); // Awesome Blog
Settings::setExtraColumns(['tenant_id' => 2])->get('site_title'); // null

settings();

settings([$key => $value]);

settings([$key => $value], null, ['tenant_id' => 1])

settings('key'); // value

settings($key, $default, ['tenant_id' => 1])

php artisan vendor:publish --provider="Ferri\LaravelSettings\ServiceProvider" --tag=config
php artisan vendor:publish --provider="Ferri\LaravelSettings\ServiceProvider" --tag=migrations