From da9c6c26f585709d4ee3a0691c3e3a42424f7be6 Mon Sep 17 00:00:00 2001 From: Mischa Spelt Date: Mon, 31 Jul 2017 02:05:31 +0200 Subject: [PATCH] Podcast/details added, changed routes to add title to download/stream; added podcats/deatils --- api/app/Http/Controllers/PodcastController.php | 12 ++++++++++++ api/routes/web.php | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/api/app/Http/Controllers/PodcastController.php b/api/app/Http/Controllers/PodcastController.php index 607a7a6..c0c67be 100644 --- a/api/app/Http/Controllers/PodcastController.php +++ b/api/app/Http/Controllers/PodcastController.php @@ -48,6 +48,18 @@ QUERY; return $this->getPodcastList($request, '`podcast_meta`.`program` = :program', ['program' => (int)$program]); } + + /** + * Details over een specifieke podcast + */ + public function details(Request $request, $id) { + $podcasts = app('db')->select(self::$BASE_SQL . ' AND `podcast`.`id` = :podcast', ['podcast' => (int)$id]); + if(count($podcasts) != 1) { + return abort(404); + } + + return response()->json(new \Model\Podcast($podcasts[0])); + } private function getPodcastList(Request $request, $filter, $params) { diff --git a/api/routes/web.php b/api/routes/web.php index 5af5a11..9222f13 100644 --- a/api/routes/web.php +++ b/api/routes/web.php @@ -25,9 +25,10 @@ $app->get('agenda/kalender[/{year:\d\d\d\d}/{month:\d\d?}]', 'AgendaController@c $app->get('agenda/details/{id:\d+}', 'AgendaController@item' ); $app->get('podcast/overzicht', 'PodcastController@overview' ); +$app->get('podcast/details/{id:\d+}', 'PodcastController@details' ); $app->get('podcast/programma/{id:\d+}', 'PodcastController@program' ); -$app->get('podcast/download/{id:\d+}', 'PodcastController@download' ); -$app->get('podcast/stream/{id:\d+}', 'PodcastController@stream' ); +$app->get('podcast/download/{id:\d+}/{title}', 'PodcastController@download' ); +$app->get('podcast/stream/{id:\d+}/{title}', 'PodcastController@stream' ); $app->get('programma/schema/nustraks', 'ProgramController@comingup' ); $app->get('programma/schema/week[/{shiftWeeks:-?\d+}]', 'ProgramController@schedule' );