Skip to content

Commit

Permalink
Merge pull request #152 from rafis/master
Browse files Browse the repository at this point in the history
Use connection bound to model instead of default
  • Loading branch information
franzose committed Dec 25, 2015
2 parents 789cba7 + b3e7443 commit 6f26c1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Franzose/ClosureTable/Models/ClosureTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function insertNode($ancestorId, $descendantId)
SELECT {$descendantId}, {$descendantId}, 0
";

DB::statement($query);
DB::connection($this->connection)->statement($query);
}

/**
Expand Down Expand Up @@ -112,7 +112,7 @@ public function moveNodeTo($ancestorId = null)
AND subtbl.{$ancestor} = {$thisDescendantId}
";

DB::statement($query);
DB::connection($this->connection)->statement($query);
}

/**
Expand Down Expand Up @@ -144,7 +144,7 @@ protected function unbindRelationships()
)
";

DB::delete($query);
DB::connection($this->connection)->delete($query);
}

/**
Expand All @@ -154,7 +154,7 @@ protected function unbindRelationships()
*/
public function getPrefixedTable()
{
return DB::getTablePrefix() . $this->getTable();
return DB::connection($this->connection)->getTablePrefix() . $this->getTable();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Franzose/ClosureTable/Models/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6f26c1c

Please sign in to comment.