diff --git a/src/Franzose/ClosureTable/Models/ClosureTable.php b/src/Franzose/ClosureTable/Models/ClosureTable.php index 2f2452c..45fcd07 100644 --- a/src/Franzose/ClosureTable/Models/ClosureTable.php +++ b/src/Franzose/ClosureTable/Models/ClosureTable.php @@ -65,7 +65,7 @@ public function insertNode($ancestorId, $descendantId) SELECT {$descendantId}, {$descendantId}, 0 "; - DB::statement($query); + DB::connection($this->connection)->statement($query); } /** @@ -112,7 +112,7 @@ public function moveNodeTo($ancestorId = null) AND subtbl.{$ancestor} = {$thisDescendantId} "; - DB::statement($query); + DB::connection($this->connection)->statement($query); } /** @@ -144,7 +144,7 @@ protected function unbindRelationships() ) "; - DB::delete($query); + DB::connection($this->connection)->delete($query); } /** @@ -154,7 +154,7 @@ protected function unbindRelationships() */ public function getPrefixedTable() { - return DB::getTablePrefix() . $this->getTable(); + return DB::connection($this->connection)->getTablePrefix() . $this->getTable(); } /** diff --git a/src/Franzose/ClosureTable/Models/Entity.php b/src/Franzose/ClosureTable/Models/Entity.php index 8cdeb6b..8d76f74 100644 --- a/src/Franzose/ClosureTable/Models/Entity.php +++ b/src/Franzose/ClosureTable/Models/Entity.php @@ -713,7 +713,7 @@ public function addChild(EntityInterface $child, $position = null, $returnChild public function addChildren(array $children) { if ($this->exists) { - \DB::transaction(function () use ($children) { + \DB::connection($this->connection)->transaction(function () use ($children) { $lastChildPosition = $this->getLastChildPosition(); foreach ($children as $child) {