/** * Map the redirect routes. * * @param UrlGenerator $url * @param Router $router * @param Request $request * @param RedirectRepositoryInterface $redirects * @internal param Filesystem $files * @internal param Application $application */ public function map(UrlGenerator $url, Router $router, Request $request, RedirectRepositoryInterface $redirects) { if ($request->segment(1) == 'admin') { return; } /* @var RedirectInterface $redirect */ foreach ($redirects->sorted() as $redirect) { if (!starts_with($parsed = $redirect->getFrom(), ['http://', 'https://', '//'])) { $parsed = $url->to($redirect->getFrom()); } $parsed = parse_url(preg_replace_callback("/\\{[a-z]+\\?\\}/", function ($matches) { return str_replace('?', '!', $matches[0]); }, $parsed)); if (isset($parsed['host']) && $parsed['host'] == $request->getHost()) { /** * Route a domain redirect in a domain group. */ $router->group(['domain' => $parsed['host']], function () use($parsed, $router, $redirect) { $path = ltrim(preg_replace_callback("/\\{[a-z]+\\!\\}/", function ($matches) { return str_replace('!', '?', $matches[0]); }, $parsed['path']), '/'); $router->any($path ?: '/', ['uses' => 'Anomaly\\RedirectsModule\\Http\\Controller\\RedirectsController@handle', 'redirect' => $redirect->getId()])->where(['any' => '(.*)', 'path' => '(.*)']); }); } else { /** * Route a standard redirect. */ $router->any($redirect->getFrom(), ['uses' => 'Anomaly\\RedirectsModule\\Http\\Controller\\RedirectsController@handle', 'redirect' => $redirect->getId()])->where(['any' => '(.*)', 'path' => '(.*)']); } } }
/** * Map additional routes. * * @param Router $router * @param Repository $config */ public function map(Router $router, Repository $config) { $tag = $config->get('anomaly.module.posts::paths.tag'); $module = $config->get('anomaly.module.posts::paths.module'); $category = $config->get('anomaly.module.posts::paths.category'); $permalink = $config->get('anomaly.module.posts::paths.route'); /** * Map the RSS methods. */ $router->any("{$module}/rss/category/{category}.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@category', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/rss/tag/{tag}.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@tag', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/rss.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@recent', 'streams::addon' => 'anomaly.module.posts']); /** * Map other public routes. * Mind the order. Routes are * handled first come first serve. */ $router->any("{$module}/{type}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\TypesController@index', 'streams::addon' => 'anomaly.module.posts']); $router->any($module, ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@index', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/preview/{id}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@preview', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/{$tag}/{tag}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\TagsController@index', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/{$category}/{category}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\CategoriesController@index', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/archive/{year}/{month?}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\ArchiveController@index', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/{$permalink}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@view', 'streams::addon' => 'anomaly.module.posts']); }
/** * @param Router $router */ public function map(Router $router) { $router->group(['namespace' => $this->namespace, 'prefix' => 'backend', 'middleware' => ['web', 'theme:backend', 'lang', 'configure:backend']], function (Router $router) { $router->get('/', function () { return redirect(url('backend/c/dashboard')); }); $router->group(['middleware' => 'guest'], function (Router $router) { $router->get('login', 'Auth\\AuthController@getLogin'); $router->post('login', 'Auth\\AuthController@postLogin'); $router->get('forgot-password', 'Auth\\PasswordController@getEmail'); $router->post('forgot-password', 'Auth\\PasswordController@postEmail'); $router->get('reset-password/{code}', 'Auth\\PasswordController@getReset'); $router->post('reset-password', 'Auth\\PasswordController@postReset'); }); $router->group(['middleware' => 'auth:admin'], function (Router $router) { $router->get('logout', function () { \Auth::logout(); \Session::flush(); return redirect('/backend/login'); }); $router->any('c/{controller}', function (Request $request, $controller) { return app()->call($this->namespace . '\\' . ucfirst($controller) . 'Controller@' . ucfirst(strtolower($request->method())) . 'Index'); }); $router->any('c/{controller}/a/{action}', function (Request $request, $controller, $action) { return app()->call($this->namespace . '\\' . ucfirst($controller) . 'Controller@' . ucfirst(strtolower($request->method())) . ucfirst(strtolower($action))); }); }); }); }
/** * Map additional routes. * * @param Router $router * @param SettingRepositoryInterface $settings */ public function map(Router $router, SettingRepositoryInterface $settings) { $tag = $settings->value('anomaly.module.posts::tag_segment', 'tag'); $module = $settings->value('anomaly.module.posts::module_segment', 'posts'); $category = $settings->value('anomaly.module.posts::category_segment', 'category'); $permalink = $settings->value('anomaly.module.posts::permalink_structure', ['year', 'month', 'day', 'post']); $permalink = implode('}/{', $permalink); /** * Map the RSS methods. */ $router->any("{$module}/rss/category/{category}.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@category', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/rss/tag/{tag}.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@tag', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/rss.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@recent', 'streams::addon' => 'anomaly.module.posts']); /** * Map other public routes. * Mind the order. Routes are * handled first come first serve. */ $router->any("{$module}/{type}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\TypesController@index', 'streams::addon' => 'anomaly.module.posts']); $router->any($module, ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@index', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/preview/{id}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@preview', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/{$tag}/{tag}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\TagsController@index', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/{$category}/{category}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\CategoriesController@index', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/archive/{year}/{month?}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\ArchiveController@index', 'streams::addon' => 'anomaly.module.posts']); $router->any("{$module}/{{$permalink}}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@show', 'streams::addon' => 'anomaly.module.posts']); }
/** * Map additional routes. * * @param PageRepositoryInterface $pages */ public function map(PageRepositoryInterface $pages, Router $router) { /* @var PageCollection $pages */ $pages = $pages->sorted(); /* @var PageInterface $page */ foreach ($pages->exact(true) as $page) { $router->any($page->getPath(), ['uses' => 'Anomaly\\PagesModule\\Http\\Controller\\PagesController@view', 'streams::addon' => 'anomaly.module.pages', 'anomaly.module.pages::page' => $page->getId()]); } /* @var PageInterface $page */ foreach ($pages->exact(false) as $page) { $router->any($page->getPath() . '/{any?}', ['uses' => 'Anomaly\\PagesModule\\Http\\Controller\\PagesController@view', 'streams::addon' => 'anomaly.module.pages', 'anomaly.module.pages::page' => $page->getId(), 'where' => ['any' => '(.*)']]); } }
/** * Map the redirect routes. * * @param Filesystem $files * @param Application $application */ public function map(Router $router, RedirectRepositoryInterface $redirects) { /* @var RedirectInterface $redirect */ foreach ($redirects->all() as $redirect) { $router->any($redirect->getFrom(), ['uses' => 'Anomaly\\RedirectsModule\\Http\\Controller\\RedirectsController@handle', 'redirect' => $redirect->getId()]); } }
/** * Define the routes for authentication. * * @param \Illuminate\Routing\Router $router */ public function map(Router $router) { $router->group(['namespace' => $this->namespace], function ($router) { // Index - placeholder $router->any('{any}', ['as' => 'index', 'uses' => 'IndexController@index'])->where('any', '.*'); }); }
/** * Define the routes for the application. * * @param \Illuminate\Routing\Router $router * @return void */ public function setupRoutes(Router $router) { $config = $this->app['config']->get('elfinder.route', []); $config['namespace'] = 'Barryvdh\\Elfinder'; $router->group($config, function ($router) { $router->get('/', 'ElfinderController@showIndex'); $router->any('connector', ['as' => 'elfinder.connector', 'uses' => 'ElfinderController@showConnector']); $router->get('popup/{input_id}', ['as' => 'elfinder.popup', 'uses' => 'ElfinderController@showPopup']); $router->get('tinymce', ['as' => 'elfinder.tinymce', 'uses' => 'ElfinderController@showTinyMCE']); $router->get('tinymce4', ['as' => 'elfinder.tinymce4', 'uses' => 'ElfinderController@showTinyMCE4']); $router->get('ckeditor', ['as' => 'elfinder.ckeditor', 'uses' => 'ElfinderController@showCKeditor4']); }); }
public function boot(Router $router) { /* |-------------------------------------------------------------------------- | Publish package resources |-------------------------------------------------------------------------- */ $this->publishes([__DIR__ . '/public/assets' => public_path('assets/toolbox')], 'assets'); $this->publishes([__DIR__ . '/resources/migrations' => base_path('database/migrations')], 'migrations'); /* |-------------------------------------------------------------------------- | View path |-------------------------------------------------------------------------- */ $this->loadViewsFrom(__DIR__ . '/Views', 'admin'); /* |-------------------------------------------------------------------------- | View composer |-------------------------------------------------------------------------- */ view()->composer('*', function ($view) { $view->with('user', Auth::user()); }); /* |-------------------------------------------------------------------------- | Middleware |-------------------------------------------------------------------------- */ $router->middleware('auth', Authenticate::class); $router->middleware('logged', RedirectAuthenticated::class); /* |-------------------------------------------------------------------------- | Routes |-------------------------------------------------------------------------- */ $router->group(['middleware' => ['web'], 'prefix' => 'admin/'], function ($router) { $router->controller('auth', $this->namespace . 'AuthController'); $router->group(['middleware' => ['auth']], function ($router) { $router->any('{controller?}/{action?}/{id?}', function ($controller = 'home', $action = 'index', $id = null) { return \App::make($this->namespace . $controller . 'Controller')->callAction($action, [$id]); }); }); }); parent::boot($router); }
/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { $viewPath = __DIR__ . '/../resources/views'; $this->loadViewsFrom($viewPath, 'elfinder'); $this->publishes([$viewPath => base_path('resources/views/vendor/elfinder')], 'views'); if (!defined('ELFINDER_IMG_PARENT_URL')) { define('ELFINDER_IMG_PARENT_URL', $this->app['url']->asset('packages/barryvdh/elfinder')); } $config = $this->app['config']->get('elfinder.route', []); $config['namespace'] = 'Barryvdh\\Elfinder'; $router->group($config, function ($router) { $router->get('/', 'ElfinderController@showIndex'); $router->any('connector', ['as' => 'elfinder.connector', 'uses' => 'ElfinderController@showConnector']); $router->get('popup/{input_id}', ['as' => 'elfinder.popup', 'uses' => 'ElfinderController@showPopup']); $router->get('tinymce', ['as' => 'elfinder.tinymce', 'uses' => 'ElfinderController@showTinyMCE']); $router->get('tinymce4', ['as' => 'elfinder.tinymce4', 'uses' => 'ElfinderController@showTinyMCE4']); $router->get('ckeditor', ['as' => 'elfinder.ckeditor', 'uses' => 'ElfinderController@showCKeditor4']); }); }
/** * Register all admin routes */ public function registerRoutes() { $this->registerAssetsRoutes(); $this->registerAuthRoutes(); $this->registerImageCacheRoute(); $models = Admin::instance()->models->getAllAliases(); $this->laravelRouter->group(['prefix' => $this->prefix, 'before' => $this->getBeforeFilters(), 'namespace' => 'SleepingOwl\\Admin\\Controllers'], function () use($models) { if (empty($models)) { $models = ['__empty_models__']; } $this->laravelRouter->group(['where' => ['model' => implode('|', $models)]], function () { foreach (static::$modelRoutes as $route) { $url = $route['url']; $action = $route['action']; $method = $route['method']; $controller = isset($route['controller']) ? $route['controller'] : 'AdminController'; $this->laravelRouter->{$method}($url, ['as' => $this->routePrefix . '.table.' . $action, 'uses' => $controller . '@' . $action]); } }); $wildcardRoute = $this->laravelRouter->any('{wildcard?}', ['as' => $this->routePrefix . '.wildcard', 'uses' => 'AdminController@getWildcard'])->where('wildcard', '.*'); $this->setRoutePriority($wildcardRoute, 0); }); }
/** * Register a new route responding to all verbs. * * @param string $uri * @param \Closure|array|string $action * @return \Illuminate\Routing\Route * @static */ public static function any($uri, $action) { return \Illuminate\Routing\Router::any($uri, $action); }
/** * Register a new route responding to all verbs. * * @param string $uri * @param \Closure|array|string $action * * @return \Illuminate\Routing\Route|void */ public function any($uri, $action) { return $this->router->any($uri, $action); }
/** * Map the routes. * * @param Router $router */ public function map(Router $router) { $router->any('/', function () { return view('theme::hello'); }); }
public function any($uri, $action, $as = null) { return parent::any($uri, $this->packAction($action, $as)); }
public function boot(Router $router) { $router->any('/{any?}', 'Anomaly\\FizlPages\\Http\\Controller\\PageController@page')->where('any', '(.*)'); }
/** * Define the routes for the application. * * @param Router $router */ public function map(Router $router) { $router->any('liqpay', ['uses' => 'LiqPay\\LiqPayController@callback', 'as' => 'liqpay.callback']); }