Skip to content

Commit

Permalink
Merge pull request #105 from AdairHomes/master
Browse files Browse the repository at this point in the history
Determine database driver from model
  • Loading branch information
mavinoo authored Nov 21, 2023
2 parents 98cd248 + 11c2948 commit 3fc44da
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ public function update(Model $table, array $values, string $index = null, bool $
$index = $table->getKeyName();
}

$connection = config('database.default');
$driver = config("database.connections.{$connection}.driver");
$driver = $table->getConnection()->getDriverName();

foreach ($values as $key => $val) {
$ids[] = $val[$index];
Expand Down Expand Up @@ -174,8 +173,7 @@ public function updateWithTwoIndex(Model $table, array $values, string $index =
{
$final = [];
$ids = [];
$connection = config('database.default');
$driver = config("database.connections.{$connection}.driver");
$driver = $table->getConnection()->getDriverName();

if (!count($values)) {
return false;
Expand Down Expand Up @@ -320,8 +318,7 @@ public function insert(Model $table, array $columns, array $values, int $batchSi
}
}

$connection = config('database.default');
$driver = config("database.connections.{$connection}.driver");
$driver = $table->getConnection()->getDriverName();

if (Common::disableBacktick($driver)) {
foreach ($columns as $key => $column) {
Expand Down

0 comments on commit 3fc44da

Please sign in to comment.