return $log; }); // Prepare view $app->view(new \Slim\Views\Twig()); $app->view->parserOptions = array('charset' => 'utf-8', 'cache' => realpath('../templates/cache'), 'auto_reload' => true, 'strict_variables' => false, 'autoescape' => true); $app->view->parserExtensions = array(new \Slim\Views\TwigExtension()); if (!DB::check()) { $app->get('/hello', function () use($app) { $app->render('hello.html'); })->name('hello'); $app->get(':anyroute+', function () use($app) { $app->redirectTo('hello'); }); $app->post('/up', function () use($app) { DB::tearDown(); DB::initialize(); DB::loadData(); $app->auth->doLogout(); $app->redirectTo('home'); })->name('setup'); } if (!$app->auth->user()) { $app->post('/login', function () use($app) { $app->auth->become('admin'); $app->redirectTo('home'); })->name('auth@becomeAdmin'); $app->get('/ready', function () use($app) { $app->render('ready.html'); })->name('ready'); $app->get(':anyroute+', function () use($app) { $app->redirectTo('ready');