Ejemplo n.º 1
0
 function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     $base = $this->platformSettings->urlPrefix();
     if ($base == '') {
         $base = '*';
     } else {
         $base = "{$base}...";
     }
     return $this->router->set([$base => [AuthenticationMiddleware::class, '.' => Home::class, 'news' => NewsIndex::class, 'news/@id' => NewsForm::class]])->__invoke($request, $response, $next);
 }
Ejemplo n.º 2
0
 function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     $this->redirection->setRequest($request);
     $base = $this->settings->urlPrefix();
     $base = $base ? "{$base}..." : '*';
     return $this->router->set([$base => [when($this->settings->requireAuthentication(), AuthenticationMiddleware::class), '.' => page('platform/home.html'), 'settings...' => [when($this->settings->enableUsersManagement(), ['users-management...' => ['users' => factory(function (UsersPage $page) {
         // This is done here just to show off this possibility
         $page->templateUrl = 'platform/users/users.html';
         return $page;
     }), 'users/@id' => UserPage::class, 'profile' => factory(function (UserPage $page) {
         $page->editingSelf = true;
         return $page;
     })]])]]])->__invoke($request, $response, $next);
 }
Ejemplo n.º 3
0
 function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     return $this->router->add(['.' => simpleResponse('It works!')])->__invoke($request, $response, $next);
 }
Ejemplo n.º 4
0
 function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     return $this->router->set(['admin...' => ['home' => HomepageController::class, 'about' => AboutController::class, 'news' => NewsController::class, 'news/@id' => ArticleController::class]])->__invoke($request, $response, $next);
 }
Ejemplo n.º 5
0
 function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     return $this->router->add(['.' => page('index.html')])->__invoke($request, $response, $next);
 }
Ejemplo n.º 6
0
 function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     $auth = $this->authenticationSettings;
     return $this->router->set([$auth->urlPrefix() . '...' => [$auth->loginFormUrl() => Login::class, $auth->logoutUrl() => controller([Login::class, 'logout'])]])->__invoke($request, $response, $next);
 }
Ejemplo n.º 7
0
 function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     return $this->router->set([$this->settings->urlPrefix() . '...' => ['login' => Login::class, 'logout' => controller([Login::class, 'logout'])]])->__invoke($request, $response, $next);
 }
Ejemplo n.º 8
0
 function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
 {
     return $this->router->add(['application-builder' => Index::class])->__invoke($request, $response, $next);
 }