code: public function addCollection(RuleCollection $collection)
      {
          // we need to remove all rules with the same names first because just replacing them
          // would not place the new rule at the end of the merged array
          foreach ($collection->all() as $name => $rule) {
              unset($this->rules[$name]);
              $this->rules[$name] = $rule;
          }
  
          $this->resources = array_merge($this->resources, $collection->getResources());
      }
docs: Adds a rule collection at the end of the current set by appending all
  rules of the added collection.
  
  @param RuleCollection $collection A RuleCollection instance