PHP code example of ottosmops / settings

1. Go to this page and download the library: Download ottosmops/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/ */

    

ottosmops / settings example snippets


php artisan vendor:publish // --tag==migrations
 
php artisan migrate 
 
$setting = Setting::create(['key' => 'myKey', 
                            'type' => 'string', // integer, bool or array
                            'scope' => 'mysetting', 
                            'rules' => 'nullable|string', 
                            'description' => 'My description']);

$setting = Setting::setValue('myKey', 'myValue');

echo $setting->value // myValue from the model

// from Cache
echo setting('key'); // myValue

echo Setting::getValue('key'); // myValue

 
Setting::create(['key' => 'your_key', 'type' => 'integer']);
Setting::setValue('your_key', 37);