#4: URL generation for an album now uses all parent albums to form a complete path

This commit is contained in:
Andy Heathershaw 2017-04-17 17:15:15 +01:00
parent 7ea1dc5c83
commit e0773ba236

View File

@ -146,7 +146,19 @@ class Album extends Model
public function url() 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() public function userPermissions()