Skip to content

Commit

Permalink
the unused $targetConnection is made dynamic.
Browse files Browse the repository at this point in the history
  • Loading branch information
racibaz committed Jun 24, 2024
1 parent 905fc60 commit 7e0edb1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Console/DbSyncCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ public function handle(): bool
$mysqldumpSkipTzUtc = config('dbsync.mysqldumpSkipTzUtc') ? '--skip-tz-utc' : '';

$targetConnection = config('dbsync.targetConnection');
$defaultConnection = config('database.default');

$localUsername = config('database.connections.mysql.username');
$localPassword = config('database.connections.mysql.password');
$localHostname = config('database.connections.mysql.host');
$localPort = config('database.connections.mysql.port');
$localDatabase = config('database.connections.mysql.database');
$defaultConnection = empty($targetConnection) ? $defaultConnection: $targetConnection;

$localUsername = config("database.connections.{$defaultConnection}.username");
$localPassword = config("database.connections.{$defaultConnection}.password");
$localHostname = config("database.connections.{$defaultConnection}.host");
$localPort = config("database.connections.{$defaultConnection}.port");
$localDatabase = config("database.connections.{$defaultConnection}.database");
$localMysqlPath = config('dbsync.localMysqlPath');

if (empty($host) || empty($username) || empty($database)) {
Expand Down

0 comments on commit 7e0edb1

Please sign in to comment.