Skip to content

Commit dd6ac5f

Browse files
[8.x] Use first host if multiple (#40226)
* fixes #40186 : use first host if multiple * Update DbCommand.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent 3f5d370 commit dd6ac5f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Illuminate/Database/Console/DbCommand.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,16 @@ public function getConnection()
6767
}
6868

6969
if ($this->option('read')) {
70+
if (is_array($connection['read']['host'])) {
71+
$connection['read']['host'] = $connection['read']['host'][0];
72+
}
73+
7074
$connection = array_merge($connection, $connection['read']);
7175
} elseif ($this->option('write')) {
76+
if (is_array($connection['write']['host'])) {
77+
$connection['write']['host'] = $connection['write']['host'][0];
78+
}
79+
7280
$connection = array_merge($connection, $connection['write']);
7381
}
7482

0 commit comments

Comments
 (0)