Skip to content

Commit

Permalink
fixes laravel#40186 : use first host if multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
jelib3an committed Jan 2, 2022
1 parent 3f5d370 commit 184d869
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Illuminate/Database/Console/DbCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,14 @@ public function getConnection()
}

if ($this->option('read')) {
if (is_array($connection['read']['host'])) {
$connection['read']['host'] = $connection['read']['host'][0];
}
$connection = array_merge($connection, $connection['read']);
} elseif ($this->option('write')) {
if (is_array($connection['write']['host'])) {
$connection['write']['host'] = $connection['write']['host'][0];
}
$connection = array_merge($connection, $connection['write']);
}

Expand Down

0 comments on commit 184d869

Please sign in to comment.