Skip to content

Commit

Permalink
there is no default sort on the ancestors so we should apply an order…
Browse files Browse the repository at this point in the history
… to build the ancestor slug properly
  • Loading branch information
pauldwight committed Jan 3, 2024
1 parent 5bddccf commit 3b6e38d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Models/Behaviors/HasNesting.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function getNestedSlugAttribute()
*/
public function getAncestorsSlug(?string $locale = null): string
{
return $this->getAncestors()->reverse()
return $this->getAncestors()->sortBy('_lft')
->map(function ($i) use ($locale) {
return $i->getSlug($locale);
})
Expand Down

0 comments on commit 3b6e38d

Please sign in to comment.