/**
* Adds a route collection to the current set of routes (at the end of the current set).
*
* @param RouteCollection $collection A RouteCollection instance
* @param string $prefix An optional prefix to add before each pattern of the route collection
*
* @api
*/
public function addCollection(RouteCollection $collection, $prefix = '')
{
$collection->setParent($this);
$collection->addPrefix($prefix);
// remove all routes with the same name in all existing collections
foreach (array_keys($collection->all()) as $name) {
$this->remove($name);
}
$this->routes[] = $collection;
}