示例#1
0
 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;
 }
示例#2
0
 /**
  * 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;
 }
示例#3
0
 public static function bindMethod(Context $context)
 {
     return strtolower($context->method());
 }