MetaFox

SiteSettingRepository
in package
implements SiteSettingRepositoryInterface

Class SiteSettingRepository.

Table of Contents

Interfaces

SiteSettingRepositoryInterface
Interface SiteSetting.

Properties

$cachedValueBag  : array<string, mixed>
Keep associate `key`=> `id`.

Methods

__construct()  : mixed
bootingKernelConfigs()  : void
Update laravel config() when booting.
createSetting()  : bool
destroy()  : bool
Remove settings from core_site_settings by `module_id` and `name`.
get()  : mixed|null
Get user actual value for specific setting key.
getPrivateEnvironments()  : array<string|int, mixed>
Export private settings to build frontend.
getSiteSettings()  : array<string, array<string, mixed>>
has()  : bool
Check a settings is exists.
keys()  : array<string|int, mixed>
This method is used to generate ide:fix.
loadConfigValues()  : array<string|int, mixed>
mockValues()  : mixed
refresh()  : void
This method should be call when you want to refresh cached data after saving new values.
reset()  : bool
Reset core_site_settings to value_default by specific $module and name list.
save()  : array<string, mixed>
Save user actual values, only existed name in database can be update.
saveAndCollectPrivateSettings()  : array<string, mixed>
Save setting values and collect all private settings by $privateSettings reference.
setupPackageSettings()  : array<string, mixed>
Create/Update core_site_setting by `name`, and `value_default`.
updatedAt()  : string
Last updated time. this is alias to `get('core.setting_updated_at')`.
updateSetting()  : bool
versionId()  : int
Whenever admin updated revision, we must increment versionId This value is used to publish cache and purge caching data cross multiple distribute server.
actualValue()  : mixed
getArrayNestedKeys()  : void
Calculate dotted key of array which value is array.
getByName()  : SiteSetting|null
getValueFromDatabase()  : mixed
initialize()  : void
loadCachedValueBag()  : void
loadFromDriver()  : void

Properties

$cachedValueBag

Keep associate `key`=> `id`.

protected array<string, mixed> $cachedValueBag = []
Tags
code

[ 'blog.privacy_id'=>true, 'core.setting_version_id'=>4, '' ]

encode

Methods

bootingKernelConfigs()

Update laravel config() when booting.

public bootingKernelConfigs() : void

createSetting()

public createSetting(string $module, string $name, string|null $configName, string|null $envVar, mixed $value, string $type, bool $public, bool $auto) : bool
Parameters
$module : string
$name : string
$configName : string|null
$envVar : string|null
$value : mixed
$type : string
$public : bool
$auto : bool
Return values
bool

destroy()

Remove settings from core_site_settings by `module_id` and `name`.

public destroy(string $module[, array<string|int, mixed>|null $names = null ]) : bool

If names is null, remove all by module_id.

Parameters
$module : string
$names : array<string|int, mixed>|null = null
Return values
bool

get()

Get user actual value for specific setting key.

public get(string $key[, mixed $default = null ]) : mixed|null

If value_actual is not exists, it use alternate value_default.

Note: not all data should be saved in to cached because of data size etc: you should not keep 10Kb text string into setting cache because it push to memory at application start time.

Parameters
$key : string
$default : mixed = null
Return values
mixed|null

getPrivateEnvironments()

Export private settings to build frontend.

public getPrivateEnvironments() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSiteSettings()

public getSiteSettings(string $for, bool $loadFromDriver) : array<string, array<string, mixed>>
Parameters
$for : string

web, mobile, admin

$loadFromDriver : bool
Return values
array<string, array<string, mixed>>

has()

Check a settings is exists.

public has(string $key) : bool
Parameters
$key : string
Return values
bool

keys()

This method is used to generate ide:fix.

public keys() : array<string|int, mixed>
Return values
array<string|int, mixed>

loadConfigValues()

public loadConfigValues() : array<string|int, mixed>
Return values
array<string|int, mixed>

mockValues()

public mockValues(array<string|int, mixed> $values) : mixed
Parameters
$values : array<string|int, mixed>

refresh()

This method should be call when you want to refresh cached data after saving new values.

public refresh() : void

By default values is loaded from cached. when refresh call it will reload data from database then pull up to cache.

reset()

Reset core_site_settings to value_default by specific $module and name list.

public reset(string $module[, array<string|int, mixed>|null $names = null ]) : bool

if $names is null, it will reset all values for specific module.

Parameters
$module : string
$names : array<string|int, mixed>|null = null
Return values
bool

save()

Save user actual values, only existed name in database can be update.

public save(array<string|int, mixed> $values) : array<string, mixed>

It should not create new row.

Parameters
$values : array<string|int, mixed>
Return values
array<string, mixed>

saveAndCollectPrivateSettings()

Save setting values and collect all private settings by $privateSettings reference.

public saveAndCollectPrivateSettings(array<string|int, mixed> $values[, array<string|int, mixed>|null &$privateSettings = [] ]) : array<string, mixed>
Parameters
$values : array<string|int, mixed>
$privateSettings : array<string|int, mixed>|null = []
Return values
array<string, mixed>

setupPackageSettings()

Create/Update core_site_setting by `name`, and `value_default`.

public setupPackageSettings(string $module, array<string|int, mixed> $settings) : array<string, mixed>
Parameters
$module : string
$settings : array<string|int, mixed>
Return values
array<string, mixed>

updatedAt()

Last updated time. this is alias to `get('core.setting_updated_at')`.

public updatedAt() : string
Return values
string

updateSetting()

public updateSetting(string $module, string $name, string|null $configName, string|null $envVar, mixed $value, string $type, bool $public, bool $auto) : bool
Parameters
$module : string
$name : string
$configName : string|null
$envVar : string|null
$value : mixed
$type : string
$public : bool
$auto : bool
Return values
bool

versionId()

Whenever admin updated revision, we must increment versionId This value is used to publish cache and purge caching data cross multiple distribute server.

public versionId() : int

This is alias of $this->get('core.setting_version_id');

Return values
int

actualValue()

private actualValue(mixed $value, string $type) : mixed
Parameters
$value : mixed
$type : string

getArrayNestedKeys()

Calculate dotted key of array which value is array.

private getArrayNestedKeys(string $prefix, array<string|int, mixed> $values, array<string|int, mixed> &$keys) : void
Parameters
$prefix : string
$values : array<string|int, mixed>
$keys : array<string|int, mixed>

loadFromDriver()

private loadFromDriver(string $for, array<string|int, mixed> &$result) : void
Parameters
$for : string
$result : array<string|int, mixed>

        
On this page

Search results