From 2de284963e45c6a8b2f36536a89a01391edd8cc0 Mon Sep 17 00:00:00 2001 From: Josef Citrine Date: Thu, 18 May 2017 18:25:07 +0100 Subject: [PATCH] Added support for ponify in classifier --- .../Controllers/Api/Web/TracksController.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Api/Web/TracksController.php b/app/Http/Controllers/Api/Web/TracksController.php index 391b7bfe..a743763f 100644 --- a/app/Http/Controllers/Api/Web/TracksController.php +++ b/app/Http/Controllers/Api/Web/TracksController.php @@ -333,6 +333,14 @@ class TracksController extends ApiControllerBase $query->whereIn('track_type_id', Request::get('types')); } + $archive = null; + + if (Request::has('archive')) { + // Select which archive to view + $archive = Request::get('archive'); + $query->where('source', $archive); + } + if ($unknown) { $query->where(function ($q) { $unknownGenre = Genre::where('name', 'Unknown')->first(); @@ -344,7 +352,11 @@ class TracksController extends ApiControllerBase } }); - $query->join('mlpma_tracks', 'tracks.id', '=', 'mlpma_tracks.track_id'); + if ($archive == "mlpma") { + $query->join('mlpma_tracks', 'tracks.id', '=', 'mlpma_tracks.track_id'); + } elseif ($archive == "ponify") { + $query->join('ponify_tracks', 'tracks.id', '=', 'ponify_tracks.track_id'); + } } if (Request::has('songs')) { @@ -357,11 +369,6 @@ class TracksController extends ApiControllerBase $query->whereIn('show_song_track.show_song_id', Request::get('songs')); } - if (Request::has('archive')) { - // Select which archive to view - $query->where('source', Request::get('archive')); - } - return $query; } }