PHP code example of michaelnabil230 / laravel-setting
1. Go to this page and download the library: Download michaelnabil230/laravel-setting 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/ */
michaelnabil230 / laravel-setting example snippets
use MichaelNabil230\Setting\Models\Setting;
return [
/*
|--------------------------------------------------------------------------
| Default Settings Store
|--------------------------------------------------------------------------
|
| This option controls the default settings store that gets used while
| using this settings library.
|
| Supported: "json", "database", "redis"
|
*/
'default' => 'json',
/*
|--------------------------------------------------------------------------
| Drivers Stores
|--------------------------------------------------------------------------
|
| The settings are stored.
|
*/
'drivers' => [
'database' => [
'driver' => \MichaelNabil230\Setting\Stores\DatabaseSettingStore::class,
'options' => [
'model' => Setting::class,
'table' => 'settings', // name of table in dataBase
'cache' => [
'enableCache' => false,
'cacheTtl' => 15, // TTL in seconds.
]
],
],
'redis' => [
'driver' => \MichaelNabil230\Setting\Stores\RedisSettingStore::class,
'options' => [
'connection' => 'default',
'prefix' => 'setting',
],
],
'json' => [
'driver' => \MichaelNabil230\Setting\Stores\JsonSettingStore::class,
'options' => [
'path' => storage_path('settings.json'),
]
],
],
/*
|--------------------------------------------------------------------------
| Keys
|--------------------------------------------------------------------------
|
| Your keys are used to insert settings data.
|
*/
'keys' => [
//
],
/*
|--------------------------------------------------------------------------
| Default Settings
|--------------------------------------------------------------------------
|
| Default settings are used when a setting is not found in the store.
|
*/
'defaults' => [
//
],
];
return [
/*
|--------------------------------------------------------------------------
| Default Settings Store
|--------------------------------------------------------------------------
|
| This option controls the default settings store that gets used while
| using this settings library.
|
| Supported: "json", "database", "redis"
|
*/
'default' => 'json',
// ...
];
namespace App\Settings;
use MichaelNabil230\Setting\Stores\SettingStore as Store;
class CustomStore implements Store
{
// Implement the contract's methods here
}