diff --git a/src/Traits/LTreeModelTrait.php b/src/Traits/LTreeModelTrait.php index 76f5865..374b47b 100644 --- a/src/Traits/LTreeModelTrait.php +++ b/src/Traits/LTreeModelTrait.php @@ -112,15 +112,15 @@ public function renderAsLtree($value, $pad_string = LTreeHelper::PAD_STRING, $pa public function getAncestorByLevel(int $level = 1) { - return static::scopeAncestorByLevel($level)->first(); + return static::ancestorByLevel($level)->first(); } public function scopeAncestorByLevel(Builder $query, int $level = 1): Builder { return $query->whereRaw(sprintf( - "({$this->getLtreePathColumn()} @> text2ltree('%s')) and nlevel(path) = %d", - LTreeHelper::pathAsString($this->getLtreePath()), - $level) + "({$this->getLtreePathColumn()} @> text2ltree('%s')) and nlevel(path) = %d", + LTreeHelper::pathAsString($this->getLtreePath()), + $level) ); } }