public function __invoke() { $games = $this->gameRepository->findAll(); $viewGames = []; /** @var Game $game */ foreach ($games as $game) { $viewGames[$game->owner()->displayName()][] = $game->title(); } $viewData['gamesList'] = $viewGames; $this->view->display('games.html', $viewData); }
public function __invoke() { $title = $this->request->post('gamename'); $this->gameRepository->createGameUnsafe($title, $this->currentUser); $this->redirector->redirect(303, '/games'); }