PHP code example of junaidnasir / globalsettings

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

    

junaidnasir / globalsettings example snippets


Junaidnasir\GlobalSettings\GlobalSettingsServiceProvider::class

'GlobalSettings'  => Junaidnasir\GlobalSettings\Facades\GlobalSettings::class

GlobalSettings::set('allowUserSignUp',0);
GlobalSettings::set('userPostLimit',10);

// Get registration
if( GlobalSettings::get('allowUserSignUp'))
{
    //show form
}

// Post controller
if (count($user->post) >= GlobalSettings::get('userPostLimit'))
{
    // Can not create post limit reached
}


/* Set or update setting
*  $isActive is additional parameter 
*  to quickly disable a setting without
*  having to delete the setting
*/
set($Setting, $Value, $isActive = true);

/* Get Settings
*  return value of setting
*  or default value provided
*/
get($Setting, $default = null);

/* check if setting exists 
* return true if setting exists
* false otherwise
*/
has($Setting);

// Other Methods
update($setting, $value, $isActive);

isActive($setting);
activate($setting);
deactivate($setting);
delete($setting);

bash
php artisan vendor:publish"
bash
php artisan migrate