authorize('album.view', $album); $photos = $album->photos() ->orderBy(DB::raw('COALESCE(taken_at, created_at)')) ->paginate(UserConfig::get('items_per_page')); return Theme::render('gallery.album', [ 'album' => $album, 'photos' => $photos ]); } /** * @param $id * @return Album */ private static function loadAlbum($urlAlias) { } }