PHP code example of glorand / laravel-model-settings
1. Go to this page and download the library: Download glorand/laravel-model-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/ */
glorand / laravel-model-settings example snippets
public $settingsFieldName = 'user_settings';
use Glorand\Model\Settings\Traits\HasSettingsField;
class User extends Model
{
use HasSettingsField;
//define only if you select a different name from the default
public $settingsFieldName = 'user_settings';
//define only if the model overrides the default connection
protected $connection = 'mysql';
}
use Glorand\Model\Settings\Traits\HasSettingsTable;
class User extends Model
{
use HasSettingsTable;
}
use Glorand\Model\Settings\Traits\HasSettingsRedis;
class User extends Model
{
use HasSettingsRedis;
}
return [
// start other config options
// end other config options
// defaultConfigs
'defaultSettings' => [
'users' => [
'key_1' => 'val_1',
]
]
];
use Glorand\Model\Settings\Traits\HasSettingsTable;
class User extends Model
{
public $defaultSettings = [
'key_1' => 'val_1',
];
}