function index() { if (Auth::guest()) { $this->app->flash('info', "You must be logged in to view the admin page."); $this->app->redirect('/'); } if (!Auth::isAdmin()) { $this->app->flash('info', "You must be administrator to view the admin page."); $this->app->redirect('/'); } $variables = ['users' => User::all()]; $this->render('admin.twig', $variables); }
function all() { $users = User::all(); $this->render('users.twig', ['users' => $users]); }