Skip to content

Commit c346a63

Browse files
authored
[9.x] Adds error output to db command when missing host (#44394)
* Check for host * Formatting
1 parent 13665b7 commit c346a63

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
@@ -34,6 +34,14 @@ public function handle()
3434
{
3535
$connection = $this->getConnection();
3636

37+
if (! isset($connection['host'])) {
38+
$this->components->error('No host specified for this database connection.');
39+
$this->line(' Use the <options=bold>[--read]</> and <options=bold>[--write]</> options to specify a read or write connection.');
40+
$this->newLine();
41+
42+
return Command::FAILURE;
43+
}
44+
3745
(new Process(
3846
array_merge([$this->getCommand($connection)], $this->commandArguments($connection)),
3947
null,

0 commit comments

Comments
 (0)