PHP code example of fomvasss / laravel-variables

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

    

fomvasss / laravel-variables example snippets



Variable::all();
Variable::get('var_key');
Variable::save('app_name', 'My Var');


Variable::setGroup('en')->all(); // return Collection!
Variable::setGroup('uk')->get('var_key');
Variable::get('var_key', null, 'en'); 
Variable::get('en|var_key');
Variable::save('uk|var_key', 'UK var');

Variable::saveArray('links', ['https::google.com', 'https://laravel.com']);   // save PHP array
Variable::getArray('links');    // return default PHP array!

Variable::setGroup('uk')->save('app_name', 'Blog');
Variable::setGroup('uk')->useCache(false)->get('app_name');
//or
Variable::get('var_key', null, 'uk', false);

variable($name, $default = null, $group = null);

Variable::cacheClear();
//or
\Cache::forget('laravel.variables.cache');
bash
php artisan vendor:publish --provider="Fomvasss\Variable\VariableServiceProvider"
bash
php artisan migrate
bash
php artisan variable:cache-clear
bash
php artisan cache:forget laravel.variables.cache