diff --git a/src/Illuminate/Database/Console/DbCommand.php b/src/Illuminate/Database/Console/DbCommand.php index 3aee98e2b113..a5c627a019b8 100644 --- a/src/Illuminate/Database/Console/DbCommand.php +++ b/src/Illuminate/Database/Console/DbCommand.php @@ -14,7 +14,9 @@ class DbCommand extends Command * * @var string */ - protected $signature = 'db {connection? : The database connection that should be used}'; + protected $signature = 'db {connection? : The database connection that should be used} + {--read : Connect to the read connection} + {--write : Connect to the write connection}'; /** * The console command description. @@ -64,6 +66,12 @@ public function getConnection() $connection = (new ConfigurationUrlParser)->parseConfiguration($connection); } + if ($this->option('read')) { + $connection = array_merge($connection, $connection['read']); + } elseif ($this->option('write')) { + $connection = array_merge($connection, $connection['write']); + } + return $connection; }