public function index() { $game = Game::currentGame(); if ($game && $game->isStarted()) { $this->redirect(gameGamesPath()); } else { $this->view->render(); } }
public function create() { $game = new GameFormObject(); $game->assignAttributes($this->params); if ($game->isValid()) { $game->save(); $this->redirect(gameGamesPath()); } else { $this->view->game = $game; $this->view->render('Games/new_game'); } }