public function indexAction() { $evento = new Evento(); $proximoEvento = $evento->getProximoEvento(); $this->view->setVar('proximoEvento', $proximoEvento); echo $this->view->render('painel/index'); }
public function addAction() { $validation = new EventoValidation(); $validation->validate($this->request->getPost()); if (!$validation->isValid()) { return $this->jsonResponse(['ok' => false, 'messages' => $validation->getMessages()]); } $evento = new Evento(); $evento->exchangeArray($this->request->getPost()); try { $evento->save(); } catch (\Exception $e) { return $this->jsonResponse(['ok' => false, 'messages' => ['Erro ao tentar salvar evento.']]); } return $this->jsonResponse(['ok' => true, 'id' => $evento->getId()]); }