PHP code example of cmarfil / laravel-multiuser-json-settings
1. Go to this page and download the library: Download cmarfil/laravel-multiuser-json-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/ */
cmarfil / laravel-multiuser-json-settings example snippets
'providers' => array(
// ...
'Cmarfil\LaravelMultiUserJsonSettings\ServiceProvider',
),
'aliases' => array(
// ...
'Setting' => 'Cmarfil\LaravelMultiUserJsonSettings\Facade',
),
return array(
'table' => 'users',
'column' => 'settings',
'constraint_key' => 'id',
'default_constraint_value' => (Auth::check() ? Auth::id() : null)
'custom_constraint' => false, //'id = ' . (Auth::check() ? Auth::id() : null),
);
Setting::set('key', 'value', $constraint_value);
Setting::get('key', 'default', $constraint_value);
Setting::forget('key', $constraint_value);
Setting::has('key', $constraint_value);
Setting::all($constraint_value);
Setting::save($constraint_value);
Setting::load($constraint_value);
return array(
'table' => 'users',
'column' => 'settings',
'constraint_key' => 'id',
'default_constraint_value' => (Auth::check() ? Auth::id() : null)
'custom_constraint' => false, //'id = ' . (Auth::check() ? Auth::id() : null),
);
//Set email_notifications setting to false
Setting::set('email_notifications', false);
//Save config
Setting::save();
//Save email_notifications
return Setting::get('email_notifications');
//Set email_notifications setting to false
Setting::set('email_notifications', false, 23);
//Save config
Setting::save(23);
//Save email_notifications
return Setting::get('email_notifications', true, 23);