/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $gameweek = Gameweek::findOrFail($id); $gameweek->overFixtures = $gameweek->fixtures()->over()->get(); $gameweek->pendingFixtures = $gameweek->fixtures()->get()->filter(function ($fxt) { return $fxt->isClosed() and !$fxt->isOver(); }); $gameweek->upcomingFixtures = $gameweek->fixtures()->get()->filter(function ($fxt) { return !$fxt->isClosed(); }); $gameweek->fxtCnt = $gameweek->overFixtures->count() + $gameweek->pendingFixtures->count() + $gameweek->upcomingFixtures->count(); $clubs = Club::lists('name', 'id')->toArray(); return view('admin.gameweek.show', compact('gameweek', 'clubs')); }