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(min($scopes), max($scopes)));
  }
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(min($scopes), max($scopes)));
  }
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 ( min ( $ scopes ) , max ( $ scopes ) ) ) ; }
Provides a depth level limit for the query.

@param   query   \Illuminate\Database\Query\Builder
@param   limit   integer
@return  \Illuminate\Database\Query\Builder
Provides a depth level limit for the query .