Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add path enumerable trait #155

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix a couple of hard references to path column
  • Loading branch information
bennothommo committed Aug 31, 2023
commit 5975793a4eee86b65e8d01254746018cd9825acc
4 changes: 2 additions & 2 deletions src/Database/Traits/PathEnumerable.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function scopeAncestors(Builder $query): void
public function getEnumerablePath(): string
{
if ($this->parent()->exists()) {
return $this->parent->path . '/' . $this->id;
return $this->parent->{$this->getPathColumnName()} . '/' . $this->id;
}

return '/' . $this->id;
bennothommo marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -188,7 +188,7 @@ public function getEnumerablePath(): string
*/
public function setEnumerablePath(): void
{
$this->path = $path = $this->getEnumerablePath();
$this->{$this->getPathColumnName()} = $path = $this->getEnumerablePath();

$this->newQuery()
->where($this->getKeyName(), $this->id)
Expand Down
Loading