diff --git a/app/Album.php b/app/Album.php index 3e4fe8b..8c15d14 100644 --- a/app/Album.php +++ b/app/Album.php @@ -146,7 +146,19 @@ class Album extends Model public function url() { - return route('viewAlbum', $this->url_alias); + $parts = []; + $current = $this; + + while (!is_null($current)) + { + $parts[] = $current->url_alias; + + $current = $current->parent; + } + + $parts = array_reverse($parts); + + return route('viewAlbum', join('/', $parts)); } public function userPermissions()