From ed3d80fbef25ec183a1303402562e3d244587ae5 Mon Sep 17 00:00:00 2001 From: edalzell Date: Fri, 24 Oct 2025 12:59:03 -0700 Subject: [PATCH] tidy --- src/Http/Controllers/IcsController.php | 9 ++++----- src/Types/Event.php | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Http/Controllers/IcsController.php b/src/Http/Controllers/IcsController.php index bb36994..ba10861 100644 --- a/src/Http/Controllers/IcsController.php +++ b/src/Http/Controllers/IcsController.php @@ -25,9 +25,9 @@ class IcsController extends Controller public function __invoke(Request $request) { - $handle = $request->get('collection', 'events'); + $handle = $request->string('collection', 'events'); $date = $request->has('date') ? CarbonImmutable::parse($request->get('date')) : null; - $eventId = $request->get('event'); + $eventId = $request->string('event'); $entry = null; abort_if(! is_null($eventId) && is_null($entry = EntryFacade::find($eventId)), 404); @@ -59,14 +59,13 @@ public function __invoke(Request $request) private function downloadIcs(ICalendarEvent|array $event, string $title = 'events') { + // have to use long function syntax so we can echo within it return response()->streamDownload( function () use ($event) { echo Calendar::create()->event(Arr::wrap($event))->get(); }, Str::slugify($title).'.ics', - [ - 'Content-Type' => 'text/calendar; charset=utf-8', - ] + ['Content-Type' => 'text/calendar; charset=utf-8'] ); } } diff --git a/src/Types/Event.php b/src/Types/Event.php index 9a45788..f71f9e3 100644 --- a/src/Types/Event.php +++ b/src/Types/Event.php @@ -133,9 +133,7 @@ public function toICalendarEvent(string|CarbonInterface $date): ?ICalendarEvent */ public function toICalendarEvents(): array { - return [ - $this->toICalendarEvent($this->start()), - ]; + return Arr::wrap($this->toICalendarEvent($this->start())); } protected function location(Entry $event): ?string