diff --git a/src/Contracts/Driver.php b/src/Contracts/Driver.php index 625594e..a44833c 100644 --- a/src/Contracts/Driver.php +++ b/src/Contracts/Driver.php @@ -28,6 +28,23 @@ abstract class Driver */ protected $loaded = false; + /** + * Include and merge with fallbacks + * + * @var bool + */ + protected $with_fallback = true; + + /** + * Excludes fallback data + */ + public function withoutFallback() + { + $this->with_fallback = false; + + return $this; + } + /** * Get a specific key from the settings data. * @@ -44,7 +61,7 @@ public function get($key, $default = null) $this->load(); - return Arr::get($this->data, $key, $this->getFallback($key, $default)); + return Arr::get($this->data, $key, $default); } /** @@ -199,7 +216,10 @@ public function load($force = false) return; } - $this->data = $this->readData(); + $fallback_data = $this->with_fallback ? config('setting.fallback') : []; + $driver_data = $this->readData(); + + $this->data = array_merge((array) $fallback_data, (array) $driver_data); $this->loaded = true; }