public function get_pick_teams() { $bracket = Bracket::find(Session::get('bracketId')); // If the bracket doesn't exist // redirect back on home if (!$bracket) { return Redirect::home(); } // if there are no players // redirect to add players if (!$bracket->players) { return Redirect::to('bracket/players')->with('error', 'You do not have enough players to make a bracket.'); } // Create the tournament object from the bracket. $tournament = new Tournament($bracket); // Pick teams for the tournament. if ($teamCount = $tournament->pickTeams()) { return Redirect::to('bracket/teams'); } else { return Redirect::to('bracket/players')->with('error', 'You do not have enough players to make a bracket.'); } }