Append additional groups to an existing Route

@param Agencms\Core\Route $route
@return Illuminate\Support\Collection
550863
public function appendRoute(Route $route)
    {
        if (!$originalRoute = optional($this->routes)[$route->slug()]) {
            return "Route {$route->slug()} not found";
        }

        return $this->routes[$route->slug()]['groups'] =
            $originalRoute['groups']->merge($route->get()['groups']);
    }
695529
public function add(Route $route)
    {
        $this->addRoute($route->methods(), $route->uri(), $route->handler(), $route->name());
    }
967679
public function addRoute($route)
    {
        if (!$route instanceof Route && !is_array($route)) {
            throw new \LogicException('Route invalid. Expected Route instance or array.');
        } elseif ($route instanceof Route) {
            $name = $route->getName();
            if (isset($this->routes[$name])) {
                throw new \LogicException(sprintf('Trying to register two routes with the same name "%s"', $name));
            }
            $this->routes[$route->getName()] = $route;
        } elseif (is_array($route) && !count($route) == 4) {
            throw new \LogicException('Array Route invalid. Expected array(string|array method, string pattern, callback|string action, string name).');
        } else {
            list($methods, $patternUri, $action, $name) = array_values($route);
            
            $this->routes[$name] = new Route($methods, $patternUri, $action, $name);
        }
        
        return $this;
    }
1219129
public function create(RouteCollection $routes): Tree
    {
        $routesArray = $routes->all();

        $routesPaths = array_map(function (Route $route) {
            return $this->serializer->serialize($route->getPath());
        }, $routesArray);

        $tree = new Tree();

        /** @var RoutePath[] $pathArray */
        foreach ($routesPaths as $index => $pathArray) {
            $route = $routesArray[$index];

            /** @var TreeNode $treeNode */
            $treeNode = $tree;

            foreach ($pathArray as $path) {
                $treeNode = $this->addPathPartToTree($treeNode, $path, $route, $index);
            }
        }

        return $tree;
    }
850476
public function add($route)
    {
        if (!$route instanceof Route) {
            $route = new Route($route);
        }

        return $this->addRoute($route);
    }
979626
public function gatherRouteMiddlewares( Route $route )
	{
		return Collection::make( $route->middleware() )->map( function ( $name )
		{
			return Collection::make( $this->resolveMiddlewareClassName( $name ) );
		} )->flatten()->all();
	}
1242159
public function add( Route $route ){
		$routeId	= $route->getId();
		if( array_key_exists( $routeId, $this->routes ) ){
			throw new \DomainException( sprintf(
				'A route for pattern and method is already registered: %2$s %1$s',
				$route->getPattern(),
				$route->getMethod()
			) );
		}
		$this->routes[$routeId]	= $route;
		return $routeId;
	}
97482
public function gatherRouteMiddlewares(Route $route)
    {
        return Collection::make($route->middleware())->map(function ($m) {
            return Collection::make(array_get($this->middleware, $m, $m));
        })->collapse()->all();
    }
482432
public function addRoute(Route $route) {
        if (!in_array($route, $this->routes)) {
            $this->routes[] = $route;
        }
    }
902811
public function addRoute(Route $route) : ParsedRoute
    {
        $route = $this->applyGroupSettings($route);
        $parsedRoute = $this->parser->parse($route);
        $this->routeCollection->add($parsedRoute);

        return $parsedRoute;
    }
970717
protected static function dynamic($route)
    {
        $parms = [];
        $param = '';
        $open = false;
        //
        for ($i = 0; $i < Strings::length($route); $i++) {
            if ($open && $route[$i] != '}') {
                $param .= $route[$i];
            }
            //
            if ($route[$i] == '{' && !$open) {
                $open = true;
            } //
            elseif ($route[$i] == '}' && $open) {
                $open = !true;
                $parms[] = $param;
                $param = '';
            }
        }
        //
        return $parms;
    }
673921
public function addRoute(Route $route)
    {
        $this->routes[$route->getName()] = $route;

        $this->storage[] = $route;

        return $this;
    }
1066178
public function add(Route $route): self{
        if(isset($this->leaves[$route])){
            throw new \InvalidArgumentException(
                "Route is already registered."
            );
        }

        if(array_key_exists($route->getName(), $this->routes)){
            throw new \InvalidArgumentException(
                "Same name ({$route->getName()}) route is already registered."
            );
        }

        $queue  = new \SplQueue();

        foreach(explode("/", $route->getPath()) as $segment){
            $queue->enqueue($segment);
        }

        $queue->dequeue(); // 先頭のセグメントはすでにある(ルートノード)

        $node   = $this->rootNode;

        while(!$queue->isEmpty()){
            $segment    = $queue->dequeue();

            $node->addChild($segment);

            $node   = $node->getChild($segment);
        }

        $node->addRoute($route);

        $this->routes[$route->getName()]    = $route;
        $this->leaves[$route]               = $node;

        return $this;
    }
245301
protected function addWhereClausesToRoute($route)
    {
        $route->where(
            array_merge($this->patterns, Arr::get($route->getAction(), 'where', array()))
        );

        return $route;
    }
647261
protected function addLookups(Route $route)
    {
        $action = $route->getAction();

        if (isset($action['as'])) {
            $this->names[$action['as']] = $route;
        }

        if (isset($action['controller'])) {
            $this->actions[$action['controller']] = $route;
        }
    }
1127051
protected function addToCollections($route)
	{
		$domainAndUri = $route->domain() . $route->getUri();

		foreach ($route->methods() as $method)
		{
			$this->routes[$method][$domainAndUri] = $route;
		}

		$this->allRoutes[$method . $domainAndUri] = $route;
	}
605441
public function addRoute(Route $route)
	{
		foreach ($route->getMethods() as $method)
		{
			$this->routes[$method][/*$route->uri*/] = $route;
		}
		
		$this->allRoutes[] = $route;

		return $this;
	}