diff options
| author | horus | 2020-09-18 20:12:56 +0200 |
|---|---|---|
| committer | horus | 2020-09-18 20:12:56 +0200 |
| commit | e8f3f14a392f1cc5a69f907d1705beed77f894e6 (patch) | |
| tree | e15db4dfb378a8bafadb5d015ee0455b2b425ffb | |
| parent | 709e6684cf28f8b3008db57f9e2807544da92b41 (diff) | |
| download | senpai-e8f3f14a392f1cc5a69f907d1705beed77f894e6.tar.gz | |
add view to show specific season
| -rw-r--r-- | app/Http/Controllers/AnimeController.php | 15 | ||||
| -rw-r--r-- | routes/web.php | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/app/Http/Controllers/AnimeController.php b/app/Http/Controllers/AnimeController.php index 3c1c5c2..f2cc73e 100644 --- a/app/Http/Controllers/AnimeController.php +++ b/app/Http/Controllers/AnimeController.php @@ -171,4 +171,19 @@ class AnimeController extends Controller { return view('list_anime', ["all_anime" => $sanime, "title" => "Search", "count" => $count]); } + + public function showSeason($season_name, $season_year) { + $season_name = ucfirst($season_name); + + $anime = new Anime; + $anime = $anime->setTable('view_anime_index'); + + $anime = $anime->where('season_name', '=', $season_name)->where('season_year', '=', $season_year); + $anime = $anime->orderBy('score_today', 'desc'); + $anime = $anime->orderBy('members', 'desc'); + $anime = $anime->orderBy('watching', 'desc'); + $sanime = $anime->paginate(12); + + return view('list_anime', ["all_anime" => $sanime, "title" => $season_name . " Season " . $season_year]); + } } diff --git a/routes/web.php b/routes/web.php index 58d703d..13880a1 100644 --- a/routes/web.php +++ b/routes/web.php @@ -21,6 +21,8 @@ Route::get('/anime/surprising/', 'AnimeController@showSurprisingAnime')->name('s Route::get('/anime/top/', 'AnimeController@showTopAnime')->name('top_anime'); Route::get('/anime/{mal_id}/{slug?}', 'AnimeController@showAnime')->name('anime'); +Route::get('/anime/season/{season_name}/{season_year}', 'AnimeController@showSeason')->name('season'); + Route::get('/api/anime/{mal_id}', 'ApiController@getAnime'); Route::get('/ical/{username}', 'IndexController@ical'); |
