Add Route and Controller for ICS download
Provide a route and method for people to download an ICS file
This commit is contained in:
parent
9579dfb10c
commit
ca4795e9bc
|
|
@ -124,4 +124,16 @@ class EventViewController extends Controller
|
|||
'message' => 'Message Successfully Sent',
|
||||
]);
|
||||
}
|
||||
|
||||
public function showCalendarIcs(Request $request, $event_id)
|
||||
{
|
||||
$event = Event::findOrFail($event_id);
|
||||
|
||||
$icsContent = $event->getIcsForEvent();
|
||||
|
||||
return response()->make($icsContent, 200, [
|
||||
'Content-Type' => 'application/octet-stream',
|
||||
'Content-Disposition' => 'attachment; filename="event.ics'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,11 @@ Route::group(['prefix' => 'e'], function () {
|
|||
'uses' => 'EventViewEmbeddedController@showEmbeddedEvent',
|
||||
]);
|
||||
|
||||
Route::get('/{event_id}/calendar.ics', [
|
||||
'as' => 'downloadCalendarIcs',
|
||||
'uses' => 'EventViewController@showCalendarIcs',
|
||||
]);
|
||||
|
||||
Route::get('/{event_id}/{event_slug?}', [
|
||||
'as' => 'showEventPage',
|
||||
'uses' => 'EventViewController@showEventHome',
|
||||
|
|
|
|||
Loading…
Reference in New Issue