Webiny\Component\Router\Route\RouteCollection::prepend PHP Method

prepend() public method

Adds a Route to the beginning of current collection.
public prepend ( string $name, Route $route )
$name string Route name.
$route Route Instance of Route.
    public function prepend($name, Route $route)
    {
        $this->routes->prepend($name, $route);
    }

Usage Example

Example #1
0
 /**
  * Adds a route to the beginning of the current route collection.
  *
  * @param ConfigObject $routes An instance of ConfigObject holding the routes.
  *
  * @return $this
  */
 public function prependRoutes(ConfigObject $routes)
 {
     foreach ($routes as $name => $routeConfig) {
         self::$routeCollection->prepend($name, $this->loader->processRoute($routeConfig));
     }
     return $this;
 }