forked from mirrors/easyappointments
Added default value to the config helper
This commit is contained in:
parent
543c68133d
commit
727391aa8f
1 changed files with 5 additions and 2 deletions
|
@ -15,12 +15,15 @@
|
||||||
* Quickly fetch the value of a framework configuration.
|
* Quickly fetch the value of a framework configuration.
|
||||||
*
|
*
|
||||||
* @param string $key Configuration key.
|
* @param string $key Configuration key.
|
||||||
|
* @param mixed $default Default value in case the requested config has no value.
|
||||||
*
|
*
|
||||||
* @return mixed Returns the configuration value.
|
* @return mixed Returns the configuration value.
|
||||||
*/
|
*/
|
||||||
function config($key)
|
function config($key, $default = NULL)
|
||||||
{
|
{
|
||||||
$CI = &get_instance();
|
$CI = &get_instance();
|
||||||
|
|
||||||
return $CI->config->item($key);
|
$value = $CI->config->item($key);
|
||||||
|
|
||||||
|
return $value ?? $default;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue