Skip to content

Commit

Permalink
Merge branch 'SuperBuba-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepat committed Mar 4, 2015
2 parents f631b6b + f1e3cd1 commit 8398a30
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Baum/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,9 @@ public function scopeWithoutRoot($query) {
public function scopeLimitDepth($query, $limit) {
$depth = $this->exists ? $this->getDepth() : $this->getLevel();
$max = $depth + $limit;
$scopes = array($depth, $max);

return $query->whereBetween($this->getDepthColumnName(), array($depth, $max));
return $query->whereBetween($this->getDepthColumnName(), array(min($scopes), max($scopes)));
}

/**
Expand Down

0 comments on commit 8398a30

Please sign in to comment.