public function registerRoute()
{
$this->adminPanelRouteRegister();
$this->app->group('/admin', function () {
$this->get('/', function ($req, $res) {
return $res->withStatus(301)->withHeader('Location', $this->router->pathFor('dashboard'));
});
$this->get('/dashboard', 'App\\Controllers\\Admin\\DashboardController:index')->setName('dashboard');
$this->get('/phpinfo', 'App\\Controllers\\Admin\\DeveloperController:phpinfo')->setName('phpinfo');
if (!Session::has('auth') || !Session::get('auth')) {
$this->get('/{page:.*}', function ($req, $res) {
return $res->withStatus(301)->withHeader('Location', $this->router->pathFor('dashboard'));
});
}
})->add(new AuthMiddleware());
}