Setting
An individual setting stored in the tblconfiguration table.
Properties summary
| Type | Property | Description | |
|---|---|---|---|
| $incrementing | Settings don't have an auto-incrementing key. | ||
| protected | $table | ||
| protected string | $primaryKey | Configuration settings are keyed on the 'setting' column. | |
| $unique | 'setting' is a unique column. | ||
| $guardedForUpdate | Once set, we cannot change a setting's 'setting' column. | ||
| protected | $fillable | Allow mass assignment of setting values. | |
| protected | $booleanValues | The following settings have boolean values. | |
| protected | $nonEmptyValues | The following settings may not be null or empty. | |
| protected | $commaSeparatedValues | ||
| static protected | $defaultKeyValuePairs | Inheriting classes may provide a default key/value list for allDefaults() collection return | |
| string | $setting | ||
| string | $value |
Methods summary
| Return Type | Method Name | Description | |
|---|---|---|---|
| static | boot() | Load events around settings. | |
| static Collection | allDefaults() | Retrieve a collection of models that each have a default value assigned | |
| Builder | scopeUpdater(Builder $query) | Retrieve all updater settings. | |
| static string|null | getValue(string $setting) | Retrieve a WHMCS setting value by setting key name. | |
| static Setting | setValue(string $key, mixed $value) | Set a configuration value. | |
| static array | allAsArray() | Retrieve all settings as a key value pair array. | |
| string[] | getBooleanValues() | Return the setting names whose value should be boolean, but is stored as one of many boolean-ish strings | |
| string[] | getCommaSeparatedValues() | Return the setting names whose value should be an array, but is stored as a csv | |
| Collection|SettingCollection | newCollection(array $models = array()) | Get a collection of models |
Details
static
boot ()
Load events around settings.
static Collection
allDefaults ()
Retrieve a collection of models that each have a default value assigned
Collection will only contain models for which a default is known (via $defaultKeyValuePairs property of the model class)
Builder
scopeUpdater (Builder $query)
Retrieve all updater settings.
static string|null
getValue (string $setting)
Retrieve a WHMCS setting value by setting key name.
Return null if the setting isn't found.
static Setting
setValue (string $key, mixed $value)
Set a configuration value.
Insert the new config setting if $key doesn't exist, otherwise update the existing $key.
static array
allAsArray ()
Retrieve all settings as a key value pair array.
string[]
getBooleanValues ()
Return the setting names whose value should be boolean, but is stored as one of many boolean-ish strings
string[]
getCommaSeparatedValues ()
Return the setting names whose value should be an array, but is stored as a csv
Collection|SettingCollection
newCollection (array $models = array())
Get a collection of models
This overrides Eloquent's collection and returns one specific, and more powerful, to the context of Setting key/value data