public function connect(array $config)
{
if (!is_null($this->connection)) {
return;
}
$this->config = $config;
$options = array_get($this->config, 'options', array());
$this->connection = new \MongoClient($this->getDsn($config), $options);
//Select database
$this->db = $this->connection->{$config['database']};
return $this;
}
/** * Make the database connection instance. * * @param string $name * @return Illuminate\Database\Connection */ protected function makeConnection($name) { $config = $this->getConfig($name); if (isset($this->extensions[$name])) { return call_user_func($this->extensions[$name], $config); } $connection = new Connection(); return $connection->connect($config); }