生成 vue admin routes
438190
private function generateResourceRoutes()
    {
        $this->comment("Resources routes...");
        if (!$this->checkWilling('resource')) {
            return $this->line("\tskip");
        }

        $variables = [
            'STARTER' => $this->starter,
        ];
        $routesPath = $this->getDestinationPath('resource.routes');
        $routesContent = Utils::renderTemplate(
            config('zgldh-scaffold.templates.resource.routes', 'zgldh.scaffold::raw.resources.assets.routes'),
            $variables);
        Utils::writeFile($routesPath, $routesContent);

        $routeLine = "require('{$this->moduleDirectoryName}/{$this->starter->getModuleName()}/resources/assets/routes.js').default";
        Utils::addToVueRoute($routeLine);
    }
932865
function createRouter(ClonedVue) {
    var routes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

    var VueRouter = require('vue-router');

    if (typeof VueRouter.default === 'function') {
        VueRouter = VueRouter.default;
    }

    ClonedVue.use(VueRouter);

    var normalizedRoutes = routes.map(function (route) {
        return typeof route === 'string' ? stubRoute(route) : route;
    });

    return new VueRouter({
        mode: 'abstract',
        routes: normalizedRoutes
    });
}
484415
protected function createAdmin()
	{
		$site = Route::input( 'site', Input::get( 'site', 'default' ) );
		$lang = Input::get( 'lang', config( 'app.locale', 'en' ) );
		$resource = Route::input( 'resource' );

		$aimeos = app( 'aimeos' )->get();
		$paths = $aimeos->getCustomPaths( 'admin/jqadm/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 ) );

		$view = app( 'aimeos.view' )->create( $context, $paths, $lang );

		$view->aimeosType = 'Laravel';
		$view->aimeosVersion = app( 'aimeos' )->getVersion();
		$view->aimeosExtensions = implode( ',', $aimeos->getExtensions() );

		$context->setView( $view );

		return \Aimeos\Admin\JQAdm::create( $context, $aimeos, $resource );
	}
1333427
protected function generateRoutes()
    {
        if (defined('NAILS_STARTUP_GENERATE_APP_ROUTES') && NAILS_STARTUP_GENERATE_APP_ROUTES) {
            $oRoutesService = Factory::service('Routes');
            if (!$oRoutesService->update()) {
                throw new NailsException('Failed to generate routes_app.php. ' . $oRoutesService->lastError(), 500);
            } else {
                $oInput = Factory::service('Input');
                redirect($oInput->server('REQUEST_URI'), 'auto', 307);
            }
        }
    }
924506
function createRouter(ClonedVue, routes = []) {
    let VueRouter = require('vue-router');

    if (typeof VueRouter.default === 'function') {
        VueRouter = VueRouter.default;
    }

    ClonedVue.use (VueRouter);

    const normalizedRoutes = routes.map(route => {
        return typeof route === 'string'
            ? stubRoute(route)
            : route;
    });

    return new VueRouter({
        mode: 'abstract',
        routes: normalizedRoutes,
    });
}
772130
public function build(AdminInterface $admin, RouteCollection $collection)
    {
        $collection->add('list');
        $collection->add('create');
        $collection->add('batch', null, [], [], [], '', [], ['POST']);
        $collection->add('edit', $admin->getRouterIdParameter().'/edit', [], ['id' => '.+']);
        $collection->add('delete', $admin->getRouterIdParameter().'/delete', [], ['id' => '.+']);
        $collection->add('export');
        $collection->add('show', $admin->getRouterIdParameter().'/show', [], ['id' => '.+'], [], '', [], ['GET']);

        if ($admin->isAclEnabled()) {
            $collection->add('acl', $admin->getRouterIdParameter().'/acl', [], ['id' => '.+']);
        }

        // add children urls
        foreach ($admin->getChildren() as $children) {
            $collection->addCollection($children->getRoutes());
        }
    }
400133
private function createRoutes()
    {
        $this->routeCollection->add('_content', new Route('/{slug}', [
            '_controller' => 'OpiferContentBundle:Frontend/Content:view',
            'slug'        => '',
        ], [
            'slug'        => "[a-zA-Z0-9\-_\/]*",
        ], [
            'expose'      => true,
        ]));
        $this->routeCollection->add('home', new Route('/', [
            '_controller' => 'OpiferContentBundle:Frontend/Content:view',
            'slug'        => '',
        ], [
            'slug'        => "[a-zA-Z0-9\-_\/]*",
        ], [
            'expose'      => true,
        ]));
    }
1176674
public function actionCreate()
    {
        Yii::$app->getResponse()->format = Response::FORMAT_JSON;
        $routes = Yii::$app->getRequest()->post('route', '');
        $routes = preg_split('/\s*,\s*/', trim($routes), -1, PREG_SPLIT_NO_EMPTY);
        $model = new AdminRoute();
        $model->addNew($routes);
        return $model->getRoutes();
    }
444331
function buildRoutes(name, mutator, mutatorOptions) {
	var basePath = '/' + name

	// POST - run the content through the mutator and return a revisit.link compatible object
	plugin.route({
		method: 'POST',
		path: basePath + '/service',
		handler: mutatorOptions.rawPayload ? postHandlerRawPayload : postHandler,
		config: {
			validate: {
				payload: revisitorSchema
			},
			response: {
				schema: revisitorSchema
			}
		}
	})

	function postHandler(request, reply) {
		var imgBuf = dataUriToBuffer(request.payload.content.data),
			imgType = imgBuf.type

		mutator(imgBuf, function(err, mutatedBuffer) {
			if (err) {
				return reply(err).code(400)
			}

			var resp = {
				content: {
					data: 'data:image/' + imgType + ';base64,' + mutatedBuffer.toString('base64')
				},
				meta: request.payload.meta
			}

			reply(resp).code(200)
		})
	}

	function postHandlerRawPayload(request, reply) {
		var rawPayload = request.payload

		mutator(rawPayload, function(err, rawPayloadReply) {
			if (err) {
				return reply(err).code(400)
			}

			reply(rawPayloadReply).code(200)
		})
	}
}
1134101
public function routes()
	{
		Route::group(array('prefix' => $this->config->get('coanda::coanda.admin_path')), function()
		{
			// All module admin routes should be wrapper in the auth filter
			Route::group(array('before' => 'admin_auth'), function()
			{
				foreach ($this->modules as $module)
				{
					$module->adminRoutes();
				}
			});

			// We will put the main admin controller outside the group so it can handle its own filters
			Route::controller('/', 'CoandaCMS\Coanda\Controllers\AdminController');

		});

		// Let the module output any front end 'user' routes
		foreach ($this->modules as $module)
		{
			$module->userRoutes();
		}

		App::before( function () {

			Route::match(['GET', 'POST'], 'search', function () {
				
				// Pass this route to the search provider, it can do whatever it likes!
				return Coanda::search()->handleSearch();

			});

			Route::match(['GET', 'POST'], '{slug}', function ($slug)
			{
				return Coanda::route($slug);

			})->where('slug', '[\.\/_\-\_A-Za-z0-9]+');

			Route::match(['GET', 'POST'], '/', function ()
			{
				return Coanda::routeHome();

			});

		});

	}
139495
public function generateRouterData(array $routes, ?callable $transform = null): array
    {
        $static = [];
        $dynamic = [];
        
        foreach ($routes as $route) {
            $compiled = $this->compileRoute($route);
            
            if ($compiled[self::KEY_REGEX] === '') {
                $prefix = $compiled[self::KEY_PREFIX];
                $route = $compiled[self::KEY_ROUTE];
                
                if (isset($static[$prefix])) {
                    if (\is_array($static[$prefix])) {
                        $static[$prefix][] = $route;
                    } else {
                        $static[$prefix] = [
                            $static[$prefix],
                            $route
                        ];
                    }
                } else {
                    $static[$prefix] = $route;
                }
            } else {
                $dynamic[] = $compiled;
            }
        }
        
        \usort($dynamic, static function (array $a, array $b): int {
            $p = ($b[self::KEY_PRIORITY] <=> $a[self::KEY_PRIORITY]);
            
            if ($p !== 0) {
                return $p;
            }
            
            $p = \strcmp($a[self::KEY_PREFIX], $b[self::KEY_PREFIX]);
            
            if ($p !== 0) {
                return $p;
            }
            
            return \strcmp($a[self::KEY_REGEX], $b[self::KEY_REGEX]);
        });
        
        $matches = \array_column($dynamic, 0);
        $grouped = [];
        
        $regex = "'^(?";
        
        for ($len = \count($dynamic), $i = 0; $i < $len; $i++) {
            if (isset($dynamic[$i + 1]) && $dynamic[$i + 1][self::KEY_PREFIX] == $dynamic[$i][self::KEY_PREFIX]) {
                $regex .= '|' . \preg_quote($dynamic[$i][self::KEY_PREFIX], "'") . '(?';
                
                $tmp = [
                    $dynamic[$i][self::KEY_REGEX] => [
                        $i => $dynamic[$i][self::KEY_PRIORITY]
                    ]
                ];
                
                do {
                    $i++;
                    
                    $tmp[$dynamic[$i][self::KEY_REGEX]][$i] = $dynamic[$i][self::KEY_PRIORITY];
                } while (isset($dynamic[$i + 1]) && $dynamic[$i + 1][self::KEY_PREFIX] == $dynamic[$i][self::KEY_PREFIX]);
                
                foreach ($tmp as & $t) {
                    \arsort($t, \SORT_NUMERIC);
                }
                
                foreach ($tmp as $k => $v) {
                    $regex .= '|' . $k . '(*MARK:G' . \count($grouped) . ')';
                    $grouped[] = \count($v);
                    
                    if ($transform) {
                        $grouped = \array_merge($grouped, \array_map(static function (int $i) use ($dynamic, $transform) {
                            return $transform($dynamic[$i][self::KEY_ROUTE], $i);
                        }, \array_keys($v)));
                    } else {
                        $grouped = \array_merge($grouped, \array_keys($v));
                    }
                }
                
                $regex .= ')';
            } else {
                $regex .= '|' . \preg_quote($dynamic[$i][self::KEY_PREFIX], "'") . $dynamic[$i][self::KEY_REGEX] . '(*MARK:R' . $i . ')';
            }
        }
        
        $regex .= ")$'i";
        
        return [
            $static,
            $regex,
            $matches,
            $grouped,
            $routes
        ];
    }
1339378
function generateController(path, modelName, modelFields, generateMethod, ts, cb) {
    var extension = (ts) ? 'ts' : 'js';
    var controller = ft.loadTemplateSync('controller.' + extension);

    var updateFields = '';
    var createFields = os.EOL;

    modelFields.forEach(function (f, index, fields) {
        var field = f.name;

        updateFields += modelName + '.' + field + ' = req.body.' + field + ' ? req.body.' + field + ' : ' +
            modelName + '.' + field + ';';
        updateFields += os.EOL + '\t\t\t';

        createFields += '\t\t\t' + field + ' : req.body.' + field;
        createFields += ((fields.length - 1) > index) ? ',' + os.EOL : '';
    });

    controller = controller.replace(/{modelName}/g, formatTools.capitalizeFirstLetter(modelName) + 'Model');
    controller = controller.replace(/{name}/g, modelName);
    controller = controller.replace(/{pluralName}/g, formatTools.pluralize(modelName));
    controller = controller.replace(/{controllerName}/g, modelName + 'Controller');
    controller = controller.replace(/{createFields}/g, createFields);
    controller = controller.replace(/{updateFields}/g, updateFields);

    if (generateMethod === 't') {
        ft.createDirIfIsNotDefined(path, 'controllers', function () {
            controller = controller.replace(/{modelPath}/g, '\'../models/' + modelName + 'Model.' + extension + '\'');
            ft.writeFile(path + '/controllers/' + modelName + 'Controller.' + extension, controller, null, cb);
        });
    } else {
        ft.createDirIfIsNotDefined(path, modelName, function () {
            controller = controller.replace(/{modelPath}/g, '\'./' + modelName + 'Model.' + extension + '\'');
            ft.writeFile(path + '/' + modelName + '/' + modelName + 'Controller.' + extension, controller, null, cb);
        });
    }
}
245193
public function generateRoutes()
    {
        $routes = property_exists(app(), 'router')? app()->router->getRoutes() : app()->getRoutes();
        foreach ($routes as $route) {
            array_push($this->routes, [
                'method' => $route['method'],
                'uri' => $route['uri'],
                'name' => $this->getRouteName($route),
                'action' => $this->getRouteAction($route),
                'middleware' => $this->getRouteMiddleware($route),
                'map' => $this->getRouteMapTo($route)
            ]);
        }
    }
1031254
public function setupRoutes()
    {
        $routes = $this->config();

        if (PHP_SAPI == 'cli') {
            $scripts = ( isset($routes['scripts']) ? $routes['scripts'] : [] );
            foreach ($scripts as $scriptIdent => $scriptConfig) {
                $this->setupScript($scriptIdent, $scriptConfig);
            }
        } else {
            $templates = ( isset($routes['templates']) ? $routes['templates'] : [] );
            foreach ($templates as $routeIdent => $templateConfig) {
                $this->setupTemplate($routeIdent, $templateConfig);
            }

            $actions = ( isset($routes['actions']) ? $routes['actions'] : [] );
            foreach ($actions as $actionIdent => $actionConfig) {
                $this->setupAction($actionIdent, $actionConfig);
            }
        }
    }
896596
public function map()
    {
        Route::namespace($this->namespace)->group(function (Router $router) {
            /*
             * Admin routes
             */
            $router->middleware('admin')->prefix('admin')->group(function (Router $router) {
                $router->get('menus', 'AdminController@index')->name('admin::index-menus')->middleware('can:see-all-menus');
                $router->get('menus/create', 'AdminController@create')->name('admin::create-menu')->middleware('can:create-menu');
                $router->get('menus/{menu}/edit', 'AdminController@edit')->name('admin::edit-menu')->middleware('can:update-menu');
                $router->post('menus', 'AdminController@store')->name('admin::store-menu')->middleware('can:create-menu');
                $router->put('menus/{menu}', 'AdminController@update')->name('admin::update-menu')->middleware('can:update-menu');

                $router->get('menus/{menu}/menulinks/create', 'MenulinksAdminController@create')->name('admin::create-menulink')->middleware('can:create-menu');
                $router->get('menus/{menu}/menulinks/{menulink}/edit', 'MenulinksAdminController@edit')->name('admin::edit-menulink')->middleware('can:update-menu');
                $router->post('menus/{menu}/menulinks', 'MenulinksAdminController@store')->name('admin::store-menulink')->middleware('can:create-menu');
                $router->put('menus/{menu}/menulinks/{menulink}', 'MenulinksAdminController@update')->name('admin::update-menulink')->middleware('can:update-menu');
            });

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

                    $router->get('menus/{menu}/menulinks', 'MenulinksApiController@index')->middleware('can:see-all-menus');
                    $router->patch('menus/{menu}/menulinks/{menulink}', 'MenulinksApiController@updatePartial')->middleware('can:update-menu');
                    $router->post('menus/{menu}/menulinks/sort', 'MenulinksApiController@sort')->middleware('can:update-menu');
                    $router->delete('menus/{menu}/menulinks/{menulink}', 'MenulinksApiController@destroy')->middleware('can:delete-menu');
                });
            });
        });
    }
4138
private static function routeAction()
    {
        $actionQueryString = Request::getInputValue("do", false, true);
        $actionQuery = Actions::parseActionQueryString($actionQueryString);
        
        Addons::executeComponentFunction($actionQuery->name, $actionQuery->method, @$actionQuery->arguments);
    }
422967
def admin_tools_render_dashboard_module(context, module):
    
    module.init_with_context(context)
    context.update({
        'template': module.template,
        'module': module,
        'admin_url': reverse('%s:index' % get_admin_site_name(context)),
    })
    return context