Skip to content

Commit 7e0edb1

Browse files
committed
the unused $targetConnection is made dynamic.
1 parent 905fc60 commit 7e0edb1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Console/DbSyncCommand.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@ public function handle(): bool
3838
$mysqldumpSkipTzUtc = config('dbsync.mysqldumpSkipTzUtc') ? '--skip-tz-utc' : '';
3939

4040
$targetConnection = config('dbsync.targetConnection');
41+
$defaultConnection = config('database.default');
4142

42-
$localUsername = config('database.connections.mysql.username');
43-
$localPassword = config('database.connections.mysql.password');
44-
$localHostname = config('database.connections.mysql.host');
45-
$localPort = config('database.connections.mysql.port');
46-
$localDatabase = config('database.connections.mysql.database');
43+
$defaultConnection = empty($targetConnection) ? $defaultConnection: $targetConnection;
44+
45+
$localUsername = config("database.connections.{$defaultConnection}.username");
46+
$localPassword = config("database.connections.{$defaultConnection}.password");
47+
$localHostname = config("database.connections.{$defaultConnection}.host");
48+
$localPort = config("database.connections.{$defaultConnection}.port");
49+
$localDatabase = config("database.connections.{$defaultConnection}.database");
4750
$localMysqlPath = config('dbsync.localMysqlPath');
4851

4952
if (empty($host) || empty($username) || empty($database)) {

0 commit comments

Comments
 (0)