Skip to content

ConfigUtility

App\Utilities\ConfigUtility

Add Configuration Key

php
protected $fresnsConfigItems = [
    [
        'item_key' => 'fssms_content', // Key name
        'item_value' => 1, // Key value
        'item_type' => 'number', // Key type: number, string, boolean, array, object, file, app, apps
        'is_multilingual' => 1, // Multilingual or not: 0.No / 1.Yes
        'is_api' => 0, // API output or not: 0.Disable / 1.Allow
    ],
    [
        'item_key' => 'fssms_keyid',
        'item_value' => 'adfjd3owe1nnsdf',
        'item_type' => 'string',
        'is_multilingual' => 0,
        'is_api' => 0,
    ]
];

ConfigUtility::addFresnsConfigItems($fresnsConfigItems);

If item_key exists, it will be automatically skipped

Modify Configuration Key Value

php
protected $fresnsConfigItems = [
    [
        'item_key' => 'fssms_content', // Key name
        'item_value' => 1, // Key value
        'item_type' => 'number', // Key type: number, string, boolean, array, object, file, app, apps
        'is_multilingual' => 1, // Multilingual or not: 0.No / 1.Yes
        'is_api' => 0, // API output or not: 0.Disable / 1.Allow
    ],
    [
        'item_key' => 'fssms_keyid',
        'item_value' => 'adfjd3owe1nnsdf',
        'item_type' => 'string',
        'is_multilingual' => 0,
        'is_api' => 0,
    ]
];

ConfigUtility::changeFresnsConfigItems($fresnsConfigItems);

Update if exists, create if not

Remove Configuration Key

php
$fresnsConfigKeys = [
    'fssms_type',
    'fssms_keyid'
];

ConfigUtility::removeFresnsConfigItems($fresnsConfigKeys);

Get Status Code Multilingual Description

php
ConfigUtility::getCodeMessage($code, $fskey, $langTag);
Parameter NameTypeRequiredDescription
codeNumberrequiredStatus code
fskeyStringoptionalAssociated plugin fskey, if empty, it is Fresns
langTagStringoptionalIf empty, the default language is used.

Get Account or User Login Error Count

php
ConfigUtility::getLoginErrorCount($accountId, $userId);
Parameter NameTypeRequiredDescription
accountIdNumberrequiredaccounts->id
userIdNumberoptionalusers->id

Output the number of login errors within the last 1 hour

Released under the Apache-2.0 License