We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 66b0276 commit 5900cecCopy full SHA for 5900cec
src/Connection.php
@@ -450,6 +450,16 @@ public function getPort(array $config)
450
return Arr::get($config, 'port', $this->defaults['port']);
451
}
452
453
+ /**
454
+ * Get the database name.
455
+ *
456
+ * @return null|string
457
+ */
458
+ public function getDatabase(array $config)
459
+ {
460
+ return Arr::get($config, 'database', null);
461
+ }
462
+
463
/**
464
* Get the connection username.
465
*
@@ -1210,6 +1220,11 @@ private function buildUriFromConfig(array $config): string
1210
1220
$uri .= ':' . $port;
1211
1221
1212
1222
1223
+ $database = $this->getDatabase($config);
1224
+ if ($database) {
1225
+ $uri .= '?database='.urlencode($database);
1226
1227
1213
1228
return $uri;
1214
1229
1215
1230
0 commit comments