get('view')); if (!in_array($requestedView, $validViews)) { $requestedView = $validViews[0]; } $this->authorizeForUser($this->getUser(), 'album.view', $album); // The slideshow view needs access to all photos, not paged $photos = $album->photos() ->orderBy(DB::raw('COALESCE(taken_at, created_at)')); if ($requestedView != 'slideshow') { $photos = $photos->paginate(UserConfig::get('items_per_page')); } else { $photos = $photos->get(); } return Theme::render(sprintf('gallery.album_%s', $requestedView), [ 'album' => $album, 'current_view' => $requestedView, 'photos' => $photos ]); } }