public connection ( string $name = null ) : LMongo\Connection | ||
$name | string | |
return | LMongo\Connection |
public function connection($name = null)
{
$name = $name ?: $this->getDefaultConnection();
// If we haven't created this connection, we'll create it based on the config
// provided in the application.
if (!isset($this->connections[$name])) {
$connection = $this->makeConnection($name);
$this->connections[$name] = $this->prepare($connection);
}
return $this->connections[$name];
}