some progress
This commit is contained in:
@@ -28,7 +28,27 @@ class ShowController extends Controller
|
||||
|
||||
public function season(string $slug, int $seasonNumber)
|
||||
{
|
||||
$show = Show::with('posters', 'backdrops', 'externalIds', 'networks', 'genres', 'productionCompanies')->where('slug', $slug)->first();
|
||||
|
||||
if (!$show) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$seasons = Season::where('show_id', $show->id)->orderBy('season_number', 'ASC')->get();
|
||||
$currentSeason = Season::where('show_id', $show->id)->where('season_number', $seasonNumber)->first();
|
||||
|
||||
if (!$currentSeason) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$episodes = \App\Models\Episode::where('show_id', $show->id)
|
||||
->where('season_id', $currentSeason->id)
|
||||
->orderBy('episode_number', 'ASC')
|
||||
->get();
|
||||
|
||||
$comments = [];
|
||||
|
||||
return view('show.season', compact('show', 'seasons', 'currentSeason', 'episodes', 'comments'));
|
||||
}
|
||||
|
||||
public function episode(string $slug, int $seasonNumber, int $episodeNumber)
|
||||
|
||||
Reference in New Issue
Block a user