SupportManagerSettings extends SupportManagerModel
SupportManagerSettings model
Table of Contents
Methods
| __construct() | Constructor |
| add() | Adds a new setting |
| delete() | Deletes a setting |
| edit() | Updates an existing setting |
| getSetting() | Retrieves a single setting |
| getSettings() | Retrieves all settings for a company |
| setSetting() | Sets a setting value, creating it if it doesn't exist or updating if it does |
| setSettings() | Sets multiple settings at once |
| getRules() | Fetches a list of rules for adding/editing settings |
Methods
__construct()
Constructor
public
__construct() : mixed
add()
Adds a new setting
public
add(array<string|int, mixed> $vars) : bool
Parameters
- $vars : array<string|int, mixed>
-
A list of input vars including:
- key The setting key
- company_id The company ID
- value The setting value
Return values
bool —True if the setting was added successfully, false otherwise
delete()
Deletes a setting
public
delete(string $key[, int $company_id = null ]) : bool
Parameters
- $key : string
-
The setting key
- $company_id : int = null
-
The company ID
Return values
bool —True if the setting was deleted successfully, false otherwise
edit()
Updates an existing setting
public
edit(string $key, array<string|int, mixed> $vars[, int $company_id = null ]) : bool
Parameters
- $key : string
-
The setting key
- $vars : array<string|int, mixed>
-
A list of input vars including:
- value The new setting value
- $company_id : int = null
-
The company ID
Return values
bool —True if the setting was updated successfully, false otherwise
getSetting()
Retrieves a single setting
public
getSetting(string $key[, int $company_id = null ]) : mixed
Parameters
- $key : string
-
The setting key
- $company_id : int = null
-
The company ID
Return values
mixed —The setting object if it exists, false otherwise
getSettings()
Retrieves all settings for a company
public
getSettings([int $company_id = null ]) : array<string|int, mixed>
Parameters
- $company_id : int = null
-
The company ID
Return values
array<string|int, mixed> —A list of all settings for the company
setSetting()
Sets a setting value, creating it if it doesn't exist or updating if it does
public
setSetting(string $key, mixed $value[, int $company_id = null ]) : bool
Parameters
- $key : string
-
The setting key
- $value : mixed
-
The setting value
- $company_id : int = null
-
The company ID
Return values
bool —True if the setting was set successfully, false otherwise
setSettings()
Sets multiple settings at once
public
setSettings(array<string|int, mixed> $settings[, int $company_id = null ]) : bool
Parameters
- $settings : array<string|int, mixed>
-
An array of key => value pairs
- $company_id : int = null
-
The company ID
Return values
bool —True if all settings were set successfully, false otherwise
getRules()
Fetches a list of rules for adding/editing settings
private
getRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
-
A list of input vars
- $edit : bool = false
-
True to get the edit rules, false for the add rules (optional, default false)
Return values
array<string|int, mixed> —A list of rules