public function getIndex() { $teams = []; foreach ($this->league->getTeams() as $team) { $team = new TeamRepository($team); $teams[] = ["name" => $team->getTeamName(), "attack" => $team->getOverallAttack(), "defense" => $team->getOverallDefense(), "stamina" => $team->getOverallStamina(), "creativity" => $team->getOverallCreativity(), "success" => $team->getOverallSuccessConversion(), "user" => $team->getTeamUser(), "level" => $team->getTeamLevel()]; } $user_level = new TeamRepository(Auth::user()->team); $javascript = App::make('Javascript'); $javascript::put(['teams' => $teams, 'user_level' => $user_level->getTeamLevel()]); return view("dashboard", ['league' => $this->league]); }
public function getIndex() { $matches = $this->league->getMatches(); $matchesGrouped = []; foreach ($matches as $match) { $match->first_team_name = Team::find($match->first_team_id)->name; $match->second_team_name = Team::find($match->second_team_id)->name; $matchesGrouped[$match->starts][] = $match; } $matchesGroupedWithNumericKeys = []; foreach ($matchesGrouped as $match) { $matchesGroupedWithNumericKeys[] = $match; } $teams = []; foreach ($this->league->getTeams() as $team) { $team = new TeamRepository($team); $teams[] = ["name" => $team->getTeamName(), "attack" => $team->getOverallAttack(), "defense" => $team->getOverallDefense(), "stamina" => $team->getOverallStamina(), "creativity" => $team->getOverallCreativity(), "success" => $team->getOverallSuccessConversion(), "user" => $team->getTeamUser(), "level" => $team->getTeamLevel()]; } $javascript = App::make('Javascript'); $javascript::put(['matches' => $matchesGroupedWithNumericKeys, 'teams' => $teams, 'user' => Auth::user(), 'league_id' => $this->league->getLeagueID()]); return view("league", ["league" => $this->league]); }