public static function isLoggedInFilter(Context $context) { if (session()->get('is_system_admin', false)) { if ($context->path() === '/module-manager/login') { redirect(getURL('/module-manager')); } } else { if ($context->path() !== '/module-manager/login') { redirect(getURL('/module-manager/login')); } } return true; }
/** * Route path * * @param BaseContext|Context $context * @return mixed */ public function route(BaseContext $context) { $this->currentPath = $context; $router = new AliasRouter(app()->getCollector()->getRouteAliases()); $alias = $router->route(new BaseContext($context->path())); if ($alias !== false) { $context = new Context((string) $alias, $context->domain(), $context->method(), $context->isSecure(), $context->request()); } $result = parent::route($context); /** @var \Opis\Http\Request $request */ $request = $context->request(); /** @var \Opis\Http\Response $response */ $response = $request->response(); $response->body($result); $response->send(); return $result; }
public static function bindMethod(Context $context) { return strtolower($context->method()); }