public function route($args) { parent::route($args); $result = $this->articleService->createArticle($this->request->post()); if ($result === true) { $this->app->redirect("/admin/article"); } else { $this->app->flash('error', 'Cannot create article'); $this->app->flash('article', $result); $this->app->redirect("/admin/article"); } }
public function route($args) { $id = array_shift($args); $articles = $this->articleService->getAll(); if ($id !== null) { $article = $this->articleService->getArticle($id); } elseif (isset($this->app->flashData()['article'])) { $article = $this->app->flashData()['article']; } else { $article = null; } $this->app->render('admin/admin-article.html.twig', array('token' => $_SESSION['token'], 'stylesheets' => $this->getStyles(), 'type' => 'article', 'articles' => $articles, 'article' => $article)); }