/** * @param RouteCollectionEvent $event */ public function onCollectionAutoload(RouteCollectionEvent $event) { if (0 === count($this->routeNames)) { return; } $collection = $event->getCollection(); foreach ($this->routeNames as $routeName) { $route = $collection->get($routeName); if ($route) { $route->setOption(RouteCollectionListener::OPTION_FRONTEND, true); } } }
/** * @param RouteCollectionEvent $event */ public function onCollectionAutoload(RouteCollectionEvent $event) { if ('' === $this->prefix) { return; } /** @var Route $route */ foreach ($event->getCollection()->getIterator() as $route) { $path = $route->getPath(); if (false !== strpos($path, $this->prefix)) { continue; } if ($route->hasOption(self::OPTION_FRONTEND) && $route->getOption(self::OPTION_FRONTEND)) { continue; } $route->setPath($this->prefix . $route->getPath()); } }