protected function getDispatcher() { if (!isset($this->dispatcher)) { $this->dispatcher = new Dispatcher\GroupCountBased($this->routes->getRouteData()); } return $this->dispatcher; }
/** * Populate the forum client routes. * * @param RouteCollection $routes */ protected function populateRoutes(RouteCollection $routes) { $route = $this->app->make(RouteHandlerFactory::class); $routes->get('/all', 'index', $toDefaultController = $route->toController(Controller\IndexController::class)); $routes->get('/d/{id:\\d+(?:-[^/]*)?}[/{near:[^/]*}]', 'discussion', $route->toController(Controller\DiscussionController::class)); $routes->get('/u/{username}[/{filter:[^/]*}]', 'user', $route->toController(Controller\WebAppController::class)); $routes->get('/settings', 'settings', $route->toController(Controller\AuthorizedWebAppController::class)); $routes->get('/notifications', 'notifications', $route->toController(Controller\AuthorizedWebAppController::class)); $routes->get('/logout', 'logout', $route->toController(Controller\LogOutController::class)); $routes->post('/login', 'login', $route->toController(Controller\LogInController::class)); $routes->post('/register', 'register', $route->toController(Controller\RegisterController::class)); $routes->get('/confirm/{token}', 'confirmEmail', $route->toController(Controller\ConfirmEmailController::class)); $routes->get('/reset/{token}', 'resetPassword', $route->toController(Controller\ResetPasswordController::class)); $routes->post('/reset', 'savePassword', $route->toController(Controller\SavePasswordController::class)); $this->app->make('events')->fire(new ConfigureForumRoutes($routes, $route)); $defaultRoute = $this->app->make('flarum.settings')->get('default_route'); if (isset($routes->getRouteData()[0]['GET'][$defaultRoute])) { $toDefaultController = $routes->getRouteData()[0]['GET'][$defaultRoute]; } $routes->get('/', 'default', $toDefaultController); }
protected function routes() { $this->app->instance('flarum.forum.routes', $routes = new RouteCollection()); $routes->get('/all', 'flarum.forum.index', $defaultAction = $this->action('Flarum\\Forum\\Actions\\IndexAction')); $routes->get('/d/{id:\\d+(?:-[^/]*)?}[/{near:[^/]*}]', 'flarum.forum.discussion', $this->action('Flarum\\Forum\\Actions\\DiscussionAction')); $routes->get('/u/{username}[/{filter:[^/]*}]', 'flarum.forum.user', $this->action('Flarum\\Forum\\Actions\\ClientAction')); $routes->get('/settings', 'flarum.forum.settings', $this->action('Flarum\\Forum\\Actions\\ClientAction')); $routes->get('/notifications', 'flarum.forum.notifications', $this->action('Flarum\\Forum\\Actions\\ClientAction')); $routes->get('/logout', 'flarum.forum.logout', $this->action('Flarum\\Forum\\Actions\\LogoutAction')); $routes->post('/login', 'flarum.forum.login', $this->action('Flarum\\Forum\\Actions\\LoginAction')); $routes->post('/register', 'flarum.forum.register', $this->action('Flarum\\Forum\\Actions\\RegisterAction')); $routes->get('/confirm/{token}', 'flarum.forum.confirmEmail', $this->action('Flarum\\Forum\\Actions\\ConfirmEmailAction')); $routes->get('/reset/{token}', 'flarum.forum.resetPassword', $this->action('Flarum\\Forum\\Actions\\ResetPasswordAction')); $routes->post('/reset', 'flarum.forum.savePassword', $this->action('Flarum\\Forum\\Actions\\SavePasswordAction')); event(new RegisterForumRoutes($routes)); $settings = $this->app->make('Flarum\\Core\\Settings\\SettingsRepository'); $defaultRoute = $settings->get('default_route'); if (isset($routes->getRouteData()[0]['GET'][$defaultRoute])) { $defaultAction = $routes->getRouteData()[0]['GET'][$defaultRoute]; } $routes->get('/', 'flarum.forum.default', $defaultAction); }
/** * Get the forum client routes. * * @return RouteCollection */ protected function getRoutes() { $routes = new RouteCollection(); $toController = $this->getHandlerGenerator($this->app); $routes->get('/all', 'index', $toDefaultController = $toController('Flarum\\Forum\\Controller\\IndexController')); $routes->get('/d/{id:\\d+(?:-[^/]*)?}[/{near:[^/]*}]', 'discussion', $toController('Flarum\\Forum\\Controller\\DiscussionController')); $routes->get('/u/{username}[/{filter:[^/]*}]', 'user', $toController('Flarum\\Forum\\Controller\\ClientController')); $routes->get('/settings', 'settings', $toController('Flarum\\Forum\\Controller\\ClientController')); $routes->get('/notifications', 'notifications', $toController('Flarum\\Forum\\Controller\\ClientController')); $routes->get('/logout', 'logout', $toController('Flarum\\Forum\\Controller\\LogOutController')); $routes->post('/login', 'login', $toController('Flarum\\Forum\\Controller\\LogInController')); $routes->post('/register', 'register', $toController('Flarum\\Forum\\Controller\\RegisterController')); $routes->get('/confirm/{token}', 'confirmEmail', $toController('Flarum\\Forum\\Controller\\ConfirmEmailController')); $routes->get('/reset/{token}', 'resetPassword', $toController('Flarum\\Forum\\Controller\\ResetPasswordController')); $routes->post('/reset', 'savePassword', $toController('Flarum\\Forum\\Controller\\SavePasswordController')); $this->app->make('events')->fire(new ConfigureForumRoutes($routes, $toController)); $defaultRoute = $this->app->make('flarum.settings')->get('default_route'); if (isset($routes->getRouteData()[0]['GET'][$defaultRoute])) { $toDefaultController = $routes->getRouteData()[0]['GET'][$defaultRoute]; } $routes->get('/', 'default', $toDefaultController); return $routes; }