diff --git a/src/Db/Core.php b/src/Db/Core.php index d7e6f02..af42bf0 100644 --- a/src/Db/Core.php +++ b/src/Db/Core.php @@ -98,7 +98,7 @@ public function __construct( string $dbtype = 'mysql' ) { if (class_exists('Leaf\App')) { - app()->config('db.config', $this->config); + \Leaf\Config::set('db.config', $this->config); } if ($host !== '') { @@ -263,13 +263,17 @@ public function table(string $table): self public function config($name, $value = null) { if (class_exists('Leaf\App') && function_exists('app')) { + if (!$value && is_string($name)) { + return $this->config[$name] ?? null; + } + $this->config = array_merge($this->config, $name); if (!is_array($name)) { $this->config[$name] = $value; } - app()->config('db.config', array_merge(app()->config('db.config'), $this->config)); + \Leaf\Config::set('db.config', $this->config); } else { if (is_array($name)) { $this->config = array_merge($this->config, $name);