code: public static function fromRecursive($collection)
      {
          $arr = Arr::from($collection);
  
          foreach ($arr as $key => $value) {
              if ($value instanceof stdClass || \is_iterable($value)) {
                  $value = static::fromRecursive($value);
              }
              $arr[$key] = $value;
          }
  
          return new static($arr);
      }
docs: Takes the items and recursively converts them to Bags.
  
  @param iterable|stdClass|null $collection
  
  @return static