/** * Get driver by it's name. Every driver associated with configured connection, there is minor * de-sync in naming due legacy code. * * @param string $connection * @return Driver * @throws DatabaseException */ public function driver($connection) { if (isset($this->drivers[$connection])) { return $this->drivers[$connection]; } if (!$this->config->hasConnection($connection)) { throw new DatabaseException("Unable to create Driver, no presets for '{$connection}' found."); } $this->drivers[$connection] = $this->factory->make($this->config->connectionDriver($connection), ['name' => $connection, 'config' => $this->config->connectionConfig($connection)]); return $this->drivers[$connection]; }