===========================================================================
 Admin actions
===========================================================================
 @route GET /admin/redirects
511373
def admin_index
      return if !user_is_allowed('redirects', 'view')            
      @domain = Domain.where(:domain => request.host_with_port).first      
      @redirects = @domain ? PermanentRedirect.where(:site_id => @domain.site_id).reorder(:priority).all : []            
      render :layout => 'caboose/admin'      
    end
386868
function route(
    $path = '/', $actions, $method = Router::ANY_METHOD, $name = null, array $filters = [], array $events = []
    )
    {
        if (is_array($path)) {
            foreach ($path as $p) {
                $this->collection[$name ?: count($this->collection)] = (new Route($this->Parser))
                        ->route($p, is_array($actions) ? $actions : [$actions], $method, $name, $filters, $events);
            }
        } else {
            $this->collection[$name ?: count($this->collection)] = (new Route($this->Parser))
                    ->route($path, is_array($actions) ? $actions : [$actions], $method, $name, $filters, $events);
        }

        return $this;
    }
185935
public function map()
    {
        Route::namespace($this->namespace)->group(function (Router $router) {

            /*
             * Admin routes
             */
            $router->middleware('admin')->prefix('admin')->group(function (Router $router) {
                $router->get('pages', 'AdminController@index')->name('admin::index-pages')->middleware('can:see-all-pages');
                $router->get('pages/create', 'AdminController@create')->name('admin::create-page')->middleware('can:create-page');
                $router->get('pages/{page}/edit', 'AdminController@edit')->name('admin::edit-page')->middleware('can:update-page');
                $router->post('pages', 'AdminController@store')->name('admin::store-page')->middleware('can:create-page');
                $router->put('pages/{page}', 'AdminController@update')->name('admin::update-page')->middleware('can:update-page');

                $router->get('pages/{page}/sections/create', 'SectionsAdminController@create')->name('admin::create-page_section')->middleware('can:create-page_section');
                $router->get('pages/{page}/sections/{section}/edit', 'SectionsAdminController@edit')->name('admin::edit-page_section')->middleware('can:update-page_section');
                $router->post('pages/{page}/sections', 'SectionsAdminController@store')->name('admin::store-page_section')->middleware('can:create-page_section');
                $router->put('pages/{page}/sections/{section}', 'SectionsAdminController@update')->name('admin::update-page_section')->middleware('can:update-page_section');
                $router->post('pages/{page}/sections/sort', 'SectionsAdminController@sort')->name('admin::sort-page_sections');

                $router->get('sections', 'SectionsAdminController@index')->name('admin::index-page_sections')->middleware('can:see-all-page_sections');
                $router->delete('sections/{section}', 'SectionsAdminController@destroyMultiple')->name('admin::destroy-page_section')->middleware('can:delete-page_section');
            });

            /*
             * API routes
             */
            $router->middleware('api')->prefix('api')->group(function (Router $router) {
                $router->middleware('auth:api')->group(function (Router $router) {
                    $router->get('pages', 'ApiController@index')->middleware('can:see-all-pages');
                    $router->patch('pages/{page}', 'ApiController@updatePartial')->middleware('can:update-page');
                    $router->post('pages/sort', 'ApiController@sort')->middleware('can:update-page');
                    $router->delete('pages/{page}', 'ApiController@destroy')->middleware('can:delete-page');

                    $router->get('pages/{page}/files', 'ApiController@files')->middleware('can:update-page');
                    $router->post('pages/{page}/files', 'ApiController@attachFiles')->middleware('can:update-page');
                    $router->delete('pages/{page}/files/{file}', 'ApiController@detachFile')->middleware('can:update-page');

                    $router->get('pages/{page}/sections', 'SectionsApiController@index')->middleware('can:see-all-page_sections');
                    $router->patch('pages/{page}/sections/{section}', 'SectionsApiController@updatePartial')->middleware('can:update-page_section');
                    $router->delete('pages/{page}/sections/{section}', 'SectionsApiController@destroy')->middleware('can:delete-page_section');

                    $router->get('page_sections/{section}/files', 'SectionsApiController@files')->middleware('can:update-page_section');
                    $router->post('page_sections/{section}/files', 'SectionsApiController@attachFiles')->middleware('can:update-page_section');
                    $router->delete('page_sections/{section}/files/{file}', 'SectionsApiController@detachFile')->middleware('can:update-page_section');
                });
            });

            /*
             * Front office routes
             */
            $router->middleware('public')->group(function (Router $router) {
                if (config('typicms.main_locale_in_url')) {
                    if (config('typicms.lang_chooser')) {
                        $router->get('/', 'PublicController@langChooser');
                    } else {
                        $router->get('/', 'PublicController@redirectToHomepage');
                    }
                }
                foreach (locales() as $locale) {
                    if (
                        config('app.fallback_locale') != $locale ||
                        config('typicms.main_locale_in_url')
                    ) {
                        $router->prefix($locale)->get('{uri}', 'PublicController@uri')->where('uri', '(.*)');
                    }
                }
                $router->get('{uri}', 'PublicController@uri')->where('uri', '(.*)');
            });
        });
    }
1156248
public function indexUrl()
    {
        $route = 'admin::edit-page';
        if (Route::has($route)) {
            return route($route, $this->page_id);
        }

        return route('dashboard');
    }
726480
public function route()
    {
        if (!empty($this->mod)) {
            if ($this->mod == $this->modApiName) {
                $this->cmd = $this->ctrl . '.' . $this->action;
            }
        }
        if ($this->cmd != '') {
            $cmdParams = explode('.', $this->cmd);
            if (count($cmdParams) > 2) {
                $this->mod = $cmdParams[0];
                $this->cmd = $cmdParams[1] . '.' . $cmdParams[2];
            }
            $this->routeApi();
        } else {
            $this->routeCtrl();
        }
    }
644300
public function indexUrl()
    {
        $route = 'admin::index-'.$this->getTable();
        if (Route::has($route)) {
            return route($route);
        }

        return route('dashboard');
    }
1350141
public function route()
	{
		$content = $this->_controller->{$this->_actionMethod}();

		if ($this->_controller->isJson()) {
			Request::setHeader(Request::HEADER_JSON);
			echo json_encode($content);
		} else {
			echo $content;
		}
	}
418541
public function adminLogin($route = null)
    {
        if ($this->isAdmin()) {
            return $this->redirect('admin');
        } else {
            return Admin::staticAdminLogon($route);
        }
    }
968481
protected function resolveRedirectRoute()
    {
        if (empty($this->redirectRoute)) return;

        $route = $this->system->router()->getRouteByName($this->redirectRoute);

        if (empty($route))
        {
            $this->setNotReady("Unable to find route " . $this->redirectRoute);
            return;
        }

        $this->redirectURL = $route->getPath($this->redirectParameters);
    }
843379
public function actionRemove()
    {
        $routes = Yii::$app->getRequest()->post('routes', []);
        $model = new AdminRoute();
        $model->remove($routes);
        Yii::$app->getResponse()->format = Response::FORMAT_JSON;
        return $model->getRoutes();
    }
504754
function route() {
        configure()

        middlewares()

        for (let route of config.routes) {
            if (route.type === 'view')
                server[route.method](route.src, (req, res) => {
                    res.render(`${app.root}/views/${route.dest}.twig`, {})
                })

            if (route.type === 'controller') {
                let [path, method] = route.dest.split('::')

                let controller = function () {
                    if (!app.controllers)
                        return require(`${app.root}/controllers/${path.replace('.', '/')}`)(app)

                    if (path.split('.').length > 1)
                        return app.controllers[path.split('.')[0]][path.split('.')[1]]
                    else
                        return app.controllers[path]
                }()

                let func = wrapper(controller[method])
                if (!func)
                    app.drivers.logger.error('blockbase-express - wrapper', `Undefined function ${controller}${method}`)

                if (route.method === 'post' || route.method === 'put')
                    server[route.method](route.src, upload.any(), func)
                else
                    server[route.method](route.src, func)
            }
        }

        errors()
    }
879592
public function redirectOnSuccess() {
		$params = [];
		if (!empty($this->options['bypass_hidden_from_input'])) {
			foreach ($this->options['bypass_hidden_from_input'] as $v) {
				$params[$v] = $this->options['input'][$v] ?? '';
			}
		}
		if (!empty($this->options['collection_current_tab_id'])) {
			$params[$this->options['collection_current_tab_id']] = $this->form_link;
		}
		$url = \Application::get('mvc.full') . '?' . http_build_query2($params) . '#' . ($this->options['input']['__anchor'] ?? '');
		$this->redirect($url);
	}
760258
protected function createAdmin()
	{
		$site = Route::input( 'site', Input::get( 'site', 'default' ) );
		$lang = Input::get( 'locale', config( 'app.locale', 'en' ) );
		$resource = Route::input( 'resource' );

		$aimeos = app( 'aimeos' )->get();
		$templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' );

		$context = app( 'aimeos.context' )->get( false, 'backend' );
		$context->setI18n( app('aimeos.i18n')->get( array( $lang, 'en' ) ) );
		$context->setLocale( app('aimeos.locale')->getBackend( $context, $site ) );
		$context->setView( app( 'aimeos.view' )->create( $context, $templatePaths, $lang ) );

		return \Aimeos\Admin\JsonAdm::create( $context, $aimeos, $resource );
	}
902724
public function redirectTo($route = null)
    {
        if (is_null($route)) {
            $url = $this->di->request->getCurrentUrl();
        } else {
            $url = $this->di->url->create($route);
        }
        $this->di->response->redirect($url);
    }
418849
public function setupRoutes()
    {
        $routesFile = app_path().'/Http/routes.php';

        $currentRoutes = file_get_contents($routesFile);

        if(strstr($currentRoutes,"ENTRANCE ROUTES") == false){
            $token = '';
            $routes = "\n //ENTRANCE ROUTES \n//Prefix for the paths below.
Route::group(['prefix' => config('entrance.prefix')], function() {

    Route::get('login', ['as' => 'login.index', 'uses' => function () {
        return view('entrance::pages.login');
    }]);

    // POST - Logs user in
    Route::post('login', ['as' => 'postLogin', 'uses' => config('entrance.classes.entrance_controller').'@doLogin']);
    // GET - Logs user out
    Route::get('logout', ['as' => 'logout.index', 'uses' => config('entrance.classes.entrance_controller').'@doLogout']);

    // GET- Show succes page
    Route::get('resetSuccess', ['as' => 'reset.success', 'uses' => config('entrance.classes.entrance_controller').'@showResetSuccess']);
    Route::get('success', ['as' => 'success', 'uses' => function () {
        return view('entrance::pages.success');
    }]);

    // GET - Show the send reset e-mail page/form
    Route::get('reset-password', ['as' => 'reset.password', 'uses' => function () {
        return view('entrance::pages.resetpassword');
    }]);

    // POST - Send reset e-mail
    Route::post('sendReset', ['as' => 'sendReset', 'uses' => config('entrance.classes.entrance_controller').'@sendReset']);

    // GET - Show reset page/form
    Route::get('reset/{token}', ['as' => 'password_reset', 'middleware' => 'checktoken', 'uses' => function (\$token) {
        return view('entrance::pages.reset')->with(['token' => \$token]);
    }]);

    // POST - Reset Password
    Route::post('doReset', ['as' => 'doReset', 'uses' => config('entrance.classes.entrance_controller').'@doReset']);

    // GET - Show register form
    Route::get('register', ['as' => 'register', 'uses' => function() {
        return view('entrance::pages.register');
    }]);

    // POST - Register User
    Route::post('doRegister', ['as' => 'postRegister', 'uses' => config('entrance.classes.entrance_controller').'@doRegister']);

    //Authentication group - Check if user is logged in
    Route::group(['middleware' => 'checklogin'], function() {

    });
});
        \n";


        file_put_contents($routesFile, $routes, FILE_APPEND | LOCK_EX);
        }

    }
117661
private function getRedirectRouteFromRequest()
    {
        $request  = $this->application->getRequest();
        $redirect = $request->getQuery('redirect');
        if ($redirect && $this->routeExists($redirect)) {
            return $redirect;
        }

        $redirect = $request->getPost('redirect');
        if ($redirect && $this->routeExists($redirect)) {
            return $redirect;
        }

        return false;
    }
866911
public function listAction(Request $request = null)
    {
        if (!$request->get('filter') && !$request->get('filters')) {
            return new RedirectResponse($this->admin->generateUrl('tree', $request->query->all()));
        }

        if ($listMode = $request->get('_list_mode')) {
            $this->admin->setListMode($listMode);
        }

        $datagrid = $this->admin->getDatagrid();
        $datagridValues = $datagrid->getValues();

        $datagridContextIsSet = isset($datagridValues['context']['value']) && !empty($datagridValues['context']['value']);

        //ignore `context` persistent parameter if datagrid `context` value is set
        if ($this->admin->getPersistentParameter('context') && !$datagridContextIsSet) {
            $datagrid->setValue('context', null, $this->admin->getPersistentParameter('context'));
        }

        $formView = $datagrid->getForm()->createView();

        // set the theme for the current Admin Form
        $this->setFormTheme($formView, $this->admin->getFilterTheme());

        return $this->renderWithExtraParams($this->admin->getTemplate('list'), [
            'action' => 'list',
            'form' => $formView,
            'datagrid' => $datagrid,
            'csrf_token' => $this->getCsrfToken('sonata.batch'),
        ]);
    }