private function hasCollection(RouteCollection $collection) { foreach ($this->routes as $routes) { if ($routes === $collection || $routes instanceof RouteCollection && $routes->hasCollection($collection)) { return true; } } return false; }