/** * Create a new connection instance. * * @param string $driver * @param PDO $connection * @param string $database * @param string $tablePrefix * @return Illuminate\Database\Connection */ protected function createConnection($driver, PDO $connection, $database, $tablePrefix = '', array $config = array()) { switch ($driver) { case 'odbc': return new ODBCConnection($connection, $database, $tablePrefix); case 'firebird': return new FirebirdConnection($connection, $database, $tablePrefix); } return parent::createConnection($driver, $connection, $database, $tablePrefix, $config); }
/** * Create a new connection instance with Postgresify's PostgresConnection. * * @param string $driver * @param \PDO $connection * @param string $database * @param string $prefix * @param array $config * @return \Illuminate\Database\Connection * * @throws \InvalidArgumentException */ protected function createConnection($driver, PDO $connection, $database, $prefix = '', array $config = []) { if ($this->container->bound($key = "db.connection.{$driver}")) { return $this->container->make($key, [$connection, $database, $prefix, $config]); } if ($driver === 'pgsql') { return new PostgresConnection($connection, $database, $prefix, $config); } return parent::createConnection($driver, $connection, $database, $prefix, $config); }
/** * {@inheritdoc} */ protected function createConnection($driver, $connection, $database, $prefix = '', array $config = []) { if ($this->container->bound($key = "db.connection.{$driver}")) { return $this->container->make($key, [$connection, $database, $prefix, $config]); } // Override pgsql connection if ($driver == 'pgsql') { return new PostgresConnection($connection, $database, $prefix, $config); } // use default behavior otherwise return parent::createConnection($driver, $connection, $database, $prefix, $config); }
/** * Create a new connection instance. * * @param string $driver * @param \PDO $connection * @param string $database * @param string $prefix * @param array $config * @return \Illuminate\Database\Connection * * @throws \InvalidArgumentException */ protected function createConnection($driver, PDO $connection, $database, $prefix = '', array $config = array()) { if (!app()->environment('testing')) { return parent::createConnection($driver, $connection, $database, $prefix, $config); } if ($this->container->bound($key = "db.connection.{$driver}")) { return $this->container->make($key, array($connection, $database, $prefix, $config)); } switch ($driver) { case 'mysql': return new MySqlConnection($connection, $database, $prefix, $config); case 'pgsql': return new PostgresConnection($connection, $database, $prefix, $config); case 'sqlite': return new SQLiteConnection($connection, $database, $prefix, $config); case 'sqlsrv': return new SqlServerConnection($connection, $database, $prefix, $config); } throw new InvalidArgumentException("Unsupported driver [{$driver}]"); }