/** * Display the specified resource. * * @param int $id * @return Response */ public function show(Request $request) { $groups = group::lists('name', 'group_id'); $locations = location::orderBy('location_id')->lists('location', 'location_id'); //$locations = array_merge($locations, array('0', 'National')); $group_id = $request->input('group_id'); $location_id = $request->input('location_id'); if (!isset($group_id)) { $group_id = 1; } if (!isset($location_id)) { $location_id = 0; } /* $rankings = \DB::table('rankings') ->join('players', 'rankings.player_id', '=', 'players.player_id') ->join('groups', 'rankings.group_id', '=', 'groups.group_id') ->join('locations', 'rankings.location_id', '=', 'locations.location_id') ->where('ranking_date', '=', $latest_date) ->where('rankings.group_id', '=', $group_id) ->where('rankings.location_id', '=', $location_id) ->distinct() ->get(); */ $ranking = new Ranking(); $rankings = $ranking->getlatestRankings($group_id, $location_id); return view('pages/rankings', compact('rankings', 'groups', 'locations')); }