🔧 Filter events to include only upcoming ones in calendar download

This commit is contained in:
HolgerHatGarKeineNode
2025-11-23 00:30:23 +01:00
parent 884b73211a
commit af7a05e44c

View File

@@ -22,7 +22,7 @@ class DownloadMeetupCalendar extends Controller
'meetupEvents.meetup', 'meetupEvents.meetup',
]) ])
->findOrFail($request->input('meetup')); ->findOrFail($request->input('meetup'));
$events = $meetup->meetupEvents; $events = $meetup->meetupEvents()->where('start', '>=', now())->get();
$image = $meetup->getFirstMediaUrl('logo'); $image = $meetup->getFirstMediaUrl('logo');
} elseif ($request->has('my')) { } elseif ($request->has('my')) {
$ids = $request->input('my'); $ids = $request->input('my');
@@ -30,6 +30,7 @@ class DownloadMeetupCalendar extends Controller
->with([ ->with([
'meetup', 'meetup',
]) ])
->where('start', '>=', now())
->whereHas('meetup', fn($query) => $query->whereIn('meetups.id', $ids)) ->whereHas('meetup', fn($query) => $query->whereIn('meetups.id', $ids))
->get(); ->get();
$image = asset('img/einundzwanzig-horizontal.png'); $image = asset('img/einundzwanzig-horizontal.png');
@@ -38,6 +39,7 @@ class DownloadMeetupCalendar extends Controller
->with([ ->with([
'meetup', 'meetup',
]) ])
->where('start', '>=', now())
->get(); ->get();
$image = asset('img/einundzwanzig-horizontal.png'); $image = asset('img/einundzwanzig-horizontal.png');
} }