Return default value on exception for setting()

This commit is contained in:
Nabeel S 2020-01-30 10:54:51 -05:00 committed by GitHub
parent 63b574181a
commit 02b16d5e57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -151,6 +151,8 @@ if (!function_exists('setting')) {
* @param $key
* @param mixed $default
*
* @throws \Exception
*
* @return mixed|null
*/
function setting($key, $default = null)
@ -161,6 +163,8 @@ if (!function_exists('setting')) {
$value = $settingRepo->retrieve($key);
} catch (SettingNotFound $e) {
return $default;
} catch (Exception $e) {
return $default;
}
return $value;

View File

@ -19,5 +19,5 @@ Options -Indexes
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteRule ^ /index.php [L]
</IfModule>