PHP code example of arthurydalgo / laravel-settings
1. Go to this page and download the library: Download arthurydalgo/laravel-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/ */
// Pass `true` to ignore cached settings
settings()->all($fresh = false);
// Get a single setting
settings()->get($key, $defautl = null);
// Set a single setting
settings()->set($key, $value);
// Set a multiple settings
settings()->set([
'app_name' => 'QCode',
'app_email' => '[email protected]',
'app_type' => 'SaaS'
]);
// check for setting key
settings()->has($key);
// remove a setting
settings()->remove($key);
settings()->group('team.1')->set('app_name', 'My Team App');
settings()->group('team.1')->get('app_name');
> My Team App
settings()->group('team.2')->set('app_name', 'My Team 2 App');
settings()->group('team.2')->get('app_name');
> My Team 2 App
// You can use facade
\Settings::group('team.1')->get('app_name')
> My Team App