2323use App \Models \Visibility ;
2424use App \Services \ImageHandler ;
2525use Carbon \Carbon ;
26- use Storage ;
2726use App \Services \RssFeed ;
2827use App \Services \SessionStore \ListParameterSessionStore ;
2928use App \Services \StringHelper ;
@@ -191,7 +190,11 @@ public function index(
191190
192191 // get the events
193192 $ series = $ query
194- ->with ('occurrenceType ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' , 'upcomingEvent ' )
193+ ->with (['occurrenceType ' , 'occurrenceWeek ' , 'occurrenceDay ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' => function ($ query ) {
194+ $ query ->where ('photos.is_primary ' , '= ' , 1 );
195+ }, 'upcomingEvent ' => function ($ query ) {
196+ $ query ->with (['venue.links ' , 'promoter.links ' , 'entities ' , 'tags ' , 'photos ' , 'series ' , 'eventType ' , 'eventStatus ' , 'visibility ' ]);
197+ }])
195198 ->paginate ($ listResultSet ->getLimit ());
196199
197200 return response ()->json (new SeriesCollection ($ series ));
@@ -219,7 +222,11 @@ public function popular(Request $request): JsonResponse
219222 ->groupBy ('series.id ' );
220223
221224 $ series = $ query
222- ->with (['visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' , 'upcomingEvent ' ])
225+ ->with (['occurrenceType ' , 'occurrenceWeek ' , 'occurrenceDay ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' => function ($ query ) {
226+ $ query ->where ('photos.is_primary ' , '= ' , 1 );
227+ }, 'upcomingEvent ' => function ($ query ) {
228+ $ query ->with (['venue.links ' , 'promoter.links ' , 'entities ' , 'tags ' , 'photos ' , 'series ' , 'eventType ' , 'eventStatus ' , 'visibility ' ]);
229+ }])
223230 ->orderByDesc ('attendees_count ' )
224231 ->paginate ($ limit );
225232
@@ -268,7 +275,11 @@ public function indexFollowing(
268275
269276 // get the events
270277 $ series = $ query
271- ->with (['occurrenceType ' ,'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' , 'upcomingEvent ' ])
278+ ->with (['occurrenceType ' , 'occurrenceWeek ' , 'occurrenceDay ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' => function ($ query ) {
279+ $ query ->where ('photos.is_primary ' , '= ' , 1 );
280+ }, 'upcomingEvent ' => function ($ query ) {
281+ $ query ->with (['venue.links ' , 'promoter.links ' , 'entities ' , 'tags ' , 'photos ' , 'series ' , 'eventType ' , 'eventStatus ' , 'visibility ' ]);
282+ }])
272283 ->paginate ($ listResultSet ->getLimit ());
273284
274285 // saves the updated session
@@ -346,7 +357,7 @@ public function indexCancelled(
346357 Request $ request ,
347358 ListParameterSessionStore $ listParamSessionStore ,
348359 ListEntityResultBuilder $ listEntityResultBuilder
349- ): string {
360+ ): JsonResponse {
350361 // initialized listParamSessionStore with baseindex key
351362 $ listParamSessionStore ->setBaseIndex ('internal_series ' );
352363 $ listParamSessionStore ->setKeyPrefix ('internal_series_cancelled ' );
@@ -370,29 +381,20 @@ public function indexCancelled(
370381
371382 // get the events
372383 $ series = $ query
373- ->with (['occurrenceType ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' , 'upcomingEvent ' ])
384+ ->with (['occurrenceType ' , 'occurrenceWeek ' , 'occurrenceDay ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' => function ($ query ) {
385+ $ query ->where ('photos.is_primary ' , '= ' , 1 );
386+ }, 'upcomingEvent ' => function ($ query ) {
387+ $ query ->with (['venue.links ' , 'promoter.links ' , 'entities ' , 'tags ' , 'photos ' , 'series ' , 'eventType ' , 'eventStatus ' , 'visibility ' ]);
388+ }])
374389 ->paginate ($ listResultSet ->getLimit ());
375390
376391 // saves the updated session
377392 $ listParamSessionStore ->save ();
378393
379394 $ this ->hasFilter = $ listResultSet ->getFilters () != $ listResultSet ->getDefaultFilters () || $ listResultSet ->getIsEmptyFilter ();
380395
381- return view ('series.index ' )
382- ->with (array_merge (
383- [
384- 'limit ' => $ listResultSet ->getLimit (),
385- 'sort ' => $ listResultSet ->getSort (),
386- 'direction ' => $ listResultSet ->getSortDirection (),
387- 'hasFilter ' => $ this ->hasFilter ,
388- 'filters ' => $ listResultSet ->getFilters (),
389- 'slug ' => 'Cancelled ' ,
390- ],
391- $ this ->getFilterOptions (),
392- $ this ->getListControlOptions ()
393- ))
394- ->with (compact ('series ' ))
395- ->render ();
396+ return response ()->json (new SeriesCollection ($ series ));
397+
396398 }
397399
398400 /**
@@ -404,7 +406,7 @@ public function indexWeek(
404406 Request $ request ,
405407 ListParameterSessionStore $ listParamSessionStore ,
406408 ListEntityResultBuilder $ listEntityResultBuilder
407- ): string {
409+ ): JsonResponse {
408410 // initialized listParamSessionStore with baseindex key
409411 $ listParamSessionStore ->setBaseIndex ('internal_series ' );
410412 $ listParamSessionStore ->setKeyPrefix ('internal_series_cancelled ' );
@@ -430,29 +432,19 @@ public function indexWeek(
430432
431433 // get the events
432434 $ series = $ query
433- ->with (['occurrenceType ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' , 'upcomingEvent ' ])
435+ ->with (['occurrenceType ' , 'occurrenceWeek ' , 'occurrenceDay ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' => function ($ query ) {
436+ $ query ->where ('photos.is_primary ' , '= ' , 1 );
437+ }, 'upcomingEvent ' => function ($ query ) {
438+ $ query ->with (['venue.links ' , 'promoter.links ' , 'entities ' , 'tags ' , 'photos ' , 'series ' , 'eventType ' , 'eventStatus ' , 'visibility ' ]);
439+ }])
434440 ->paginate ($ listResultSet ->getLimit ());
435441
436442 // saves the updated session
437443 $ listParamSessionStore ->save ();
438444
439445 $ this ->hasFilter = $ listResultSet ->getFilters () != $ listResultSet ->getDefaultFilters () || $ listResultSet ->getIsEmptyFilter ();
440446
441- return view ('series.index ' )
442- ->with (array_merge (
443- [
444- 'limit ' => $ listResultSet ->getLimit (),
445- 'sort ' => $ listResultSet ->getSort (),
446- 'direction ' => $ listResultSet ->getSortDirection (),
447- 'hasFilter ' => $ this ->hasFilter ,
448- 'filters ' => $ listResultSet ->getFilters (),
449- 'slug ' => 'Week ' ,
450- ],
451- $ this ->getFilterOptions (),
452- $ this ->getListControlOptions ()
453- ))
454- ->with (compact ('series ' ))
455- ->render ();
447+ return response ()->json (new SeriesCollection ($ series ));
456448 }
457449
458450 /**
@@ -490,7 +482,11 @@ public function indexRelatedTo(
490482 // get the events
491483 // @phpstan-ignore-next-line
492484 $ series = $ query ->visible ($ this ->user )
493- ->with (['occurrenceType ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' , 'upcomingEvent ' ])
485+ ->with (['occurrenceType ' , 'occurrenceWeek ' , 'occurrenceDay ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' => function ($ query ) {
486+ $ query ->where ('photos.is_primary ' , '= ' , 1 );
487+ }, 'upcomingEvent ' => function ($ query ) {
488+ $ query ->with (['venue.links ' , 'promoter.links ' , 'entities ' , 'tags ' , 'photos ' , 'series ' , 'eventType ' , 'eventStatus ' , 'visibility ' ]);
489+ }])
494490 ->paginate ($ listResultSet ->getLimit ());
495491
496492 // saves the updated session
@@ -550,7 +546,11 @@ public function indexTags(
550546
551547 // get the events
552548 $ series = $ query
553- ->with (['occurrenceType ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' , 'upcomingEvent ' ])
549+ ->with (['occurrenceType ' , 'occurrenceWeek ' , 'occurrenceDay ' , 'visibility ' , 'eventStatus ' , 'eventType ' , 'promoter ' , 'venue ' , 'tags ' , 'entities ' , 'photos ' => function ($ query ) {
550+ $ query ->where ('photos.is_primary ' , '= ' , 1 );
551+ }, 'upcomingEvent ' => function ($ query ) {
552+ $ query ->with (['venue.links ' , 'promoter.links ' , 'entities ' , 'tags ' , 'photos ' , 'series ' , 'eventType ' , 'eventStatus ' , 'visibility ' ]);
553+ }])
554554 ->paginate ($ listResultSet ->getLimit ());
555555
556556 // saves the updated session
@@ -682,7 +682,7 @@ public function export(
682682
683683 // get the events
684684 $ series = $ query
685- ->with ('occurrenceType ' , 'visibility ' , 'tags ' )
685+ ->with ([ 'occurrenceType ' , 'visibility ' , 'tags ' , ' eventType ' , ' venue ' , ' entities ' ] )
686686 ->paginate ($ listResultSet ->getLimit ());
687687
688688 // saves the updated session
0 commit comments