File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,23 @@ abstract class Driver
2828 */
2929 protected $ loaded = false ;
3030
31+ /**
32+ * Include and merge with fallbacks
33+ *
34+ * @var bool
35+ */
36+ protected $ with_fallback = true ;
37+
38+ /**
39+ * Excludes fallback data
40+ */
41+ public function withoutFallback ()
42+ {
43+ $ this ->with_fallback = false ;
44+
45+ return $ this ;
46+ }
47+
3148 /**
3249 * Get a specific key from the settings data.
3350 *
@@ -44,7 +61,7 @@ public function get($key, $default = null)
4461
4562 $ this ->load ();
4663
47- return Arr::get ($ this ->data , $ key , $ this -> getFallback ( $ key , $ default) );
64+ return Arr::get ($ this ->data , $ key , $ default );
4865 }
4966
5067 /**
@@ -199,7 +216,10 @@ public function load($force = false)
199216 return ;
200217 }
201218
202- $ this ->data = $ this ->readData ();
219+ $ fallback_data = $ this ->with_fallback ? config ('setting.fallback ' ) : [];
220+ $ driver_data = $ this ->readData ();
221+
222+ $ this ->data = array_merge ((array ) $ fallback_data , (array ) $ driver_data );
203223 $ this ->loaded = true ;
204224 }
205225
You can’t perform that action at this time.
0 commit comments