public function index()
 {
     $team = Team::find(config('mls.team_id'));
     $playerList = PlayerRepository::getActiveListByTeamId($team->id);
     $gameList = GameRepository::getListByTeamId($team->id);
     $trainingList = TrainingRepository::getActiveList($team->id);
     $statList = StatRepository::getPlayersStatistics($playerList);
     return view('frontend.teams.view')->with('team', $team)->with('playerList', $playerList)->with('gameList', $gameList)->with('trainingList', $trainingList)->with('statList', $statList);
 }
 public function showVisit(Game $game)
 {
     $team = Team::find(config('mls.team_id'));
     $playerList = PlayerRepository::getActiveListByTeamId($team->id);
     if (!isset($game->id)) {
         $game = GameRepository::getNextGameByTeamId($team->id);
     }
     if (!$game) {
         return view('frontend.game.no_game');
     }
     $gameSiblings = GameRepository::getSiblings($game);
     $visitList = StatRepository::getVisitsForGame($game->id);
     $visitList = $visitList->lists(Stat::VISIT, 'player_id');
     return view('frontend.game.index')->with('team', $team)->with('playerList', $playerList)->with('game', $game)->with('visitList', $visitList)->with('gameSiblings', $gameSiblings)->with('statusVisited', Stat::GAME_VISITED)->with('statusNotVisited', Stat::GAME_NOT_VISITED);
 }
 /**
  *   Show the edit challenge form
  *
  *   @param App\Challenge $challenge
  *   @param App\Repositories\GameRepository $gameRepo
  *
  *   @return Response
  */
 public function edit(Challenge $challenge, GameRepository $gameRepo)
 {
     $this->authorize('edit-challenge', $challenge);
     return view('challenges.edit', ['challenge' => $challenge, 'games' => $gameRepo->fetchAll()]);
 }
 public function store(Request $request)
 {
     GameRepository::saveQuickVisit($request);
     Flash::success(trans('general.updated_msg'));
     return redirect(route('admin.visits'));
 }
 /**
  *   Update the game in the database
  *
  *   @param App\Http\Requests\UpdateGameRequest $request
  *   @param App\Repositories\GameRepository $gameRepo
  *
  *   @return response
  */
 public function update(UpdateGameRequest $request, GameRepository $gameRepo, Game $game)
 {
     $game = $gameRepo->update($game, $request);
     return redirect()->route('admin.games.edit', [$game])->with('success', "Saved");
 }