From f144c6b428a7b18751dfc1de9544ee6ae45ae970 Mon Sep 17 00:00:00 2001 From: Mexion Date: Fri, 12 Apr 2019 19:03:07 +0200 Subject: [PATCH] If setting not found use the config, if config not found throw exception --- src/Setting/SettingEloquentStorage.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Setting/SettingEloquentStorage.php b/src/Setting/SettingEloquentStorage.php index 7f5b025b..bd80c719 100644 --- a/src/Setting/SettingEloquentStorage.php +++ b/src/Setting/SettingEloquentStorage.php @@ -32,7 +32,19 @@ public function all($fresh = false) */ public function get($key, $default = null, $fresh = false) { - return $this->all($fresh)->get($key, $default); + $configValue = $this->all($fresh)->get($key, $default); + + if (config('app_settings.allow_passthrough_config')) { + if (!$configValue) { + $configValue = config($key); + if (config('app_settings.exception_on_nodefined_config')) { + if (is_null($configValue)) { + throw new \Exception('Missing config value for ' . $key); + } + } + } + } + return $configValue ; } /**