class DatabaseSettingStore extends SettingStore

Properties

protected array $items

The settings items.

from  SettingStore
protected bool $unsaved

Whether the store has changed since it was last loaded.

from  SettingStore
protected bool $loaded

Whether the settings data are loaded.

from  SettingStore
protected DatabaseManager $db

The database connection instance.

protected Repository $cache

The cache instance.

protected $cacheKey
protected string $table

The table to query from.

protected string $keyColumn

The key column name to query from.

protected string $valueColumn

The value column name to query from.

protected Closure|null $queryConstraint

Any query constraints that should be applied.

protected array $extraColumns

Any extra columns that should be added to the rows.

Methods

mixed
get(string|array $key, mixed $default = null)

Get a specific key from the settings data.

bool
has(string $key)

Determine if a key exists in the settings data.

set(string|array $key, mixed $value = null)

Set a specific key to a value in the settings data.

forget(string $key)

Unset a key in the settings data.

void
forgetAll()

Unset all keys in the settings data.

array
all()

Get all settings data.

void
save()

Save any changes done to the settings data.

load(bool $force = false)

Make sure data is loaded.

array
read()

Read the data from the store.

void
write(array $data)

Write the data into the store.

__construct(DatabaseManager $db, Repository $cache)

No description

setTable(string $table)

Set the table to query from.

setKeyColumn($keyColumn)

Set the key column name to query from.

setValueColumn($valueColumn)

Set the value column name to query from.

setConstraint(Closure $callback)

Set the query constraint.

setExtraColumns(array $columns)

Set extra columns to be added to the rows.

array
prepareInsertData(array $data)

Transforms settings data into an array ready to be insterted into the database. Call array_dot on a multidimensional array before passing it into this method!

array
parseReadData(Collection $data)

Parse data coming from the database.

Builder
newQuery($insert = false)

Create a new query builder instance.

parseKeyValue($value)

No description

parseInsertKeyValue($value)

No description

mixed
getCacheKey()

No description

setCacheKey(mixed $cacheKey)

No description

flushCache()

No description

cacheCallback(Closure $callback)

No description

hasDatabase()

No description

Details

in SettingStore at line 35
mixed get(string|array $key, mixed $default = null)

Get a specific key from the settings data.

Parameters

string|array $key
mixed $default

Optional default value.

Return Value

mixed

in SettingStore at line 49
bool has(string $key)

Determine if a key exists in the settings data.

Parameters

string $key

Return Value

bool

in SettingStore at line 62
set(string|array $key, mixed $value = null)

Set a specific key to a value in the settings data.

Parameters

string|array $key

Key string or associative array of key => value

mixed $value

Optional only if the first argument is an array

at line 122
forget(string $key)

Unset a key in the settings data.

Parameters

string $key

in SettingStore at line 97
void forgetAll()

Unset all keys in the settings data.

Return Value

void

in SettingStore at line 107
array all()

Get all settings data.

Return Value

array

in SettingStore at line 118
void save()

Save any changes done to the settings data.

Return Value

void

in SettingStore at line 135
load(bool $force = false)

Make sure data is loaded.

Parameters

bool $force

Force a reload of data. Default false.

at line 224
protected array read()

Read the data from the store.

Return Value

array

at line 148
protected void write(array $data)

Write the data into the store.

Parameters

array $data

Return Value

void

at line 61
__construct(DatabaseManager $db, Repository $cache)

No description

Parameters

DatabaseManager $db
Repository $cache

at line 72
setTable(string $table)

Set the table to query from.

Parameters

string $table

at line 82
setKeyColumn($keyColumn)

Set the key column name to query from.

Parameters

$keyColumn

at line 92
setValueColumn($valueColumn)

Set the value column name to query from.

Parameters

$valueColumn

at line 102
setConstraint(Closure $callback)

Set the query constraint.

Parameters

Closure $callback

at line 114
setExtraColumns(array $columns)

Set extra columns to be added to the rows.

Parameters

array $columns

at line 200
protected array prepareInsertData(array $data)

Transforms settings data into an array ready to be insterted into the database. Call array_dot on a multidimensional array before passing it into this method!

Parameters

array $data

Call array_dot on a multidimensional array before passing it into this method!

Return Value

array

at line 243
protected array parseReadData(Collection $data)

Parse data coming from the database.

Parameters

Collection $data

Return Value

array

at line 273
protected Builder newQuery($insert = false)

Create a new query builder instance.

Parameters

$insert

boolean Whether the query is an insert or not.

Return Value

Builder

at line 291
protected parseKeyValue($value)

No description

Parameters

$value

at line 301
protected parseInsertKeyValue($value)

No description

Parameters

$value

at line 313
mixed getCacheKey()

No description

Return Value

mixed

at line 321
setCacheKey(mixed $cacheKey)

No description

Parameters

mixed $cacheKey

at line 326
flushCache()

No description

at line 334
protected cacheCallback(Closure $callback)

No description

Parameters

Closure $callback

at line 342
protected hasDatabase()

No description