Commit f087df9b authored by Taylor Otwell's avatar Taylor Otwell

Refactor database manager.

parent 614811bb
...@@ -29,14 +29,12 @@ class Manager { ...@@ -29,14 +29,12 @@ class Manager {
if ( ! array_key_exists($connection, static::$connections)) if ( ! array_key_exists($connection, static::$connections))
{ {
$config = Config::get('db.connections'); if (is_null($config = Config::get('db.connections.'.$connection)))
if ( ! array_key_exists($connection, $config))
{ {
throw new \Exception("Database connection [$connection] is not defined."); throw new \Exception("Database connection [$connection] is not defined.");
} }
static::$connections[$connection] = new Connection($connection, (object) $config[$connection], new Connector); static::$connections[$connection] = new Connection($connection, (object) $config, new Connector);
} }
return static::$connections[$connection]; return static::$connections[$connection];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment