Skip to content
Last updated

WHMCS\Config\Setting

Class · extends AbstractKeyValuePair

An individual setting stored in the tblconfiguration table.

Constants

NameDescription
API_NG_API_WHITELIST_APPLY
API_NG_API_WHITELIST
API_DEBUG_MODE
TAX_VAT_AUTO_CONFIGURATION

Properties

TypeNameDescription
``$incrementingSettings don't have an auto-incrementing key.
``$unique'setting' is a unique column.
``$guardedForUpdateOnce set, we cannot change a setting's 'setting' column.

Methods

boot

public static function boot()

Load events around settings.

allDefaults

public static function 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)

Returns \Illuminate\Database\Eloquent\Collection

scopeUpdater

public function scopeUpdater($query)

Retrieve all updater settings.

Parameters

TypeNameDescription
\Illuminate\Database\Query\Builder$query

Returns \Illuminate\Database\Query\Builder

updateRuntimeConfigCache

public static function updateRuntimeConfigCache($key, $value)

getValue

public static function getValue($setting)

Retrieve a WHMCS setting value by setting key name.

Return null if the setting isn't found.

Parameters

TypeNameDescription
string$setting

Returns string\|null

setValue

public static function setValue($key, $value)

Set a configuration value.

Insert the new config setting if $key doesn't exist, otherwise update the existing $key.

Parameters

TypeNameDescription
string$key
mixed$value

Returns Setting

deleteValue

public static function deleteValue($key)

Delete a configuration value

Parameters

TypeNameDescription
string$key

allAsArray

public static function allAsArray()

Retrieve all settings as a key value pair array.

Returns array

getBooleanValues

public function getBooleanValues()

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

Returns \string[]

getCommaSeparatedValues

public function getCommaSeparatedValues()

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

Returns \string[]

newCollection

public function 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

TypeNameDescription
array$models

Returns \Illuminate\Database\Eloquent\Collection\|SettingCollection