public function index() { $usersData = []; $usersData['count'] = User::all()->count(); $usersData['incompleteCount'] = User::where('status', 0)->count(); $picsData = []; $picsData['count'] = Pic::all()->count(); $clubsData = []; $clubsData['count'] = Club::all()->count(); $badgesData = []; $badgesData['count'] = Badge::all()->count(); $fixtures = Fixture::all(); $fixturesData = []; $fixturesData['count'] = $fixtures->count(); $fixturesData['overCount'] = $fixtures->filter(function ($fxt) { return $fxt->isOver(); })->count(); $fixturesData['closedNotOverCount'] = $fixtures->filter(function ($fxt) { return $fxt->isClosed() and !$fxt->isOver(); })->count(); $gameweeks = Gameweek::all(); $gameweeksData = []; $gameweeksData['count'] = $gameweeks->count(); $gameweeksData['completeCount'] = Gameweek::complete()->get()->count(); $gameweeksData['pendingCount'] = Gameweek::incomplete()->get()->filter(function ($gw) { return $gw->hasCompletedFixture(); })->count(); $adminsData = []; $adminsData['count'] = Admin::all()->count(); return view('admin.dashboard.index', compact('usersData', 'picsData', 'clubsData', 'badgesData', 'fixturesData', 'gameweeksData', 'adminsData')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $months = Month::lists('name', 'id')->toArray(); $runningGameweeks = Gameweek::incomplete()->get()->filter(function ($gw) { return $gw->started(); }); $runningGameweeks->each(function ($gw, $key) { $gw->overFixtureCnt = $gw->fixtures()->over()->get()->count(); $gw->pendingFixtureCnt = $gw->fixtures()->get()->filter(function ($fxt) { return $fxt->isClosed() and !$fxt->isOver(); })->count(); }); $upcomingGameweeks = Gameweek::incomplete()->get()->filter(function ($gw) { return !$gw->started(); }); $completeGameweeks = Gameweek::complete()->get(); return view('admin.gameweek.index', compact('months', 'runningGameweeks', 'upcomingGameweeks', 'completeGameweeks')); }