From 00a95b2e665c5c0d714be9a4102c04ad1938626c Mon Sep 17 00:00:00 2001 From: pxpm Date: Mon, 16 Sep 2024 09:42:05 +0100 Subject: [PATCH] use connection in db reorder --- src/app/Library/CrudPanel/Traits/Reorder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/Library/CrudPanel/Traits/Reorder.php b/src/app/Library/CrudPanel/Traits/Reorder.php index fbce437590..cb8c52a3b1 100644 --- a/src/app/Library/CrudPanel/Traits/Reorder.php +++ b/src/app/Library/CrudPanel/Traits/Reorder.php @@ -47,7 +47,7 @@ public function updateTreeOrder($request) }); // wrap the queries in a transaction to avoid partial updates - DB::transaction(function () use ($reorderItems, $primaryKey, $itemKeys) { + DB::connection($this->model->getConnectionName())->transaction(function () use ($reorderItems, $primaryKey, $itemKeys) { // create a string of ?,?,?,? to use as bind placeholders for item keys $reorderItemsBindString = implode(',', array_fill(0, count($reorderItems), '?')); @@ -68,7 +68,7 @@ public function updateTreeOrder($request) // add the where clause to the query to help match the items $query .= "ELSE {$column} END WHERE {$primaryKey} IN ({$reorderItemsBindString})"; - DB::statement($query, $bindings); + DB::connection($this->model->getConnectionName())->statement($query, $bindings); } });