PHP code example of lysice / laravel-user-settings

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

    

lysice / laravel-user-settings example snippets


  'providers' => array(
    // ...
    'Lysice\LaravelUserSettings\ServiceProvider',
  ),
  

  'aliases' => array(
    // ...
    'Setting' => 'Lysice\LaravelUserSettings\Facade',
  ),
  

return array(
  'table' => 'users',
  'column' => 'settings',
  'constraint_key' => 'id',
  'default_constraint_value' => null,
  'custom_constraint' => null,
);

Setting::set('key', 'value', $constraint_value);
setting()->set('key', 'value', $constraint_value);

Setting::get('key', 'default', $constraint_value);
setting()->get('key', 'default', $constraint_value);
setting('key', 'default', $constraint_value);

Setting::forget('key', $constraint_value);
setting()->forget('key', $constraint_value);

Setting::has('key', $constraint_value);
setting()->has('key', $constraint_value);

Setting::all($constraint_value);
setting()->all($constraint_value);

Setting::save($constraint_value);
setting()->save($constraint_value);

Setting::load($constraint_value);
setting()->load($constraint_value);

// Set 'example' setting to 'hello world'
Setting::set('example', 'hello world');

// Save to database
Setting::save();

// Get the same setting
return Setting::get('example');

// Set 'example' setting to 'hello world'
Setting::set('example', 'hello world', 23);

// Save to database
Setting::save(23);

// Get the same setting
return Setting::get('example', null, 23);