code: public function filter(RouteCollection $collection, Request $request): RouteCollection
      {
          $hasDomainMatch = false;
          $httpHost = $request->getHttpHost();
  
          foreach ($collection->all() as $route) {
              $host = $route->getHost();
  
              if ($host && $host === $httpHost) {
                  $hasDomainMatch = true;
                  break;
              }
          }
  
          if ($hasDomainMatch) {
              foreach ($collection->all() as $name => $route) {
                  $host = $route->getHost();
  
                  if (!$host || $host !== $httpHost) {
                      $collection->remove($name);
                  }
              }
          }
  
          return $collection;
      }
docs: {@inheritdoc}