belongsTo(Album::class); } public function thumbnailUrl($thumbnailName = null, $cacheBust = true) { $url = $this->album->getAlbumSource()->getUrlToPhoto($this, $thumbnailName); if ($cacheBust) { // Append the timestamp of the last update to avoid browser caching $theDate = is_null($this->updated_at) ? $this->created_at : $this->updated_at; $url .= sprintf('%s_=%d', (strpos($url, '?') === false ? '?' : '&'), $theDate->format('U')); } return $url; } public function url() { return route('viewPhoto', [ 'albumUrlAlias' => $this->album->url_alias, 'photoFilename' => $this->storage_file_name ]); } }