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
28
28
*/
29
29
protected $ loaded = false ;
30
30
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
+
31
48
/**
32
49
* Get a specific key from the settings data.
33
50
*
@@ -44,7 +61,7 @@ public function get($key, $default = null)
44
61
45
62
$ this ->load ();
46
63
47
- return Arr::get ($ this ->data , $ key , $ this -> getFallback ( $ key , $ default) );
64
+ return Arr::get ($ this ->data , $ key , $ default );
48
65
}
49
66
50
67
/**
@@ -199,7 +216,10 @@ public function load($force = false)
199
216
return ;
200
217
}
201
218
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 );
203
223
$ this ->loaded = true ;
204
224
}
205
225
You can’t perform that action at this time.
0 commit comments