33 lines
721 B
PHP
33 lines
721 B
PHP
<?php
|
|
|
|
use Modules\Setting\Repository;
|
|
|
|
if (!function_exists('setting')) {
|
|
/**
|
|
* Get / set the specified setting value.
|
|
*
|
|
* If an array is passed, we'll assume you want to set settings.
|
|
*
|
|
* @param string|array $key
|
|
* @param mixed $default
|
|
*
|
|
* @return mixed|Repository
|
|
*/
|
|
function setting($key = null, $default = null)
|
|
{
|
|
if (is_null($key)) {
|
|
return app('setting');
|
|
}
|
|
|
|
if (is_array($key)) {
|
|
return app('setting')->set($key);
|
|
}
|
|
|
|
try {
|
|
return app('setting')->get($key, $default);
|
|
} catch (PDOException) {
|
|
return $default;
|
|
}
|
|
}
|
|
}
|