An individual setting stored in the tblconfiguration table.

class Setting extends AbstractKeyValuePair

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  updateRuntimeConfigCache($key, $value) -
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  deleteValue(string $key) Delete 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)

Return Value

Collection

Builder scopeUpdater (Builder $query)

Retrieve all updater settings.

Parameters

Builder $query

Return Value

Builder

static updateRuntimeConfigCache ($key, $value)

Parameters

$key
$value

static string|null getValue (string $setting)

Retrieve a WHMCS setting value by setting key name.

Return null if the setting isn't found.

Parameters

string $setting

Return Value

string|null

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.

Parameters

string $key
mixed $value

Return Value

Setting

static deleteValue (string $key)

Delete a configuration value

Parameters

string $key

Exceptions

Exception

static array allAsArray ()

Retrieve all settings as a key value pair array.

Return Value

array

string[] getBooleanValues ()

Return the setting names whose value should be boolean, but is stored as one of many boolean-ish strings

Return Value

string[]

string[] getCommaSeparatedValues ()

Return the setting names whose value should be an array, but is stored as a csv

Return Value

string[]

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

Parameters

array $models

Return Value

Collection|SettingCollection