Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/SuperBuba/baum into Super…
Browse files Browse the repository at this point in the history
…Buba-master
  • Loading branch information
etrepat committed Mar 4, 2015
2 parents f631b6b + 1ab2ac7 commit f1e3cd1
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 f1e3cd1

Please sign in to comment.