code: final protected function getAllNodes()
      {
          if ($this->allNodes) {
              return $this->allNodes;
          }
  
          if (!method_exists($this, 'getTreeAllNodes')) {
              throw new BadMethodCallException('Method [getTreeAllNodes] does not exist.');
          }
  
          $data = $this->getTreeAllNodes(); // 由use的class来实现
  
          if (!$data instanceof ArrayAccess) {
              throw new InvalidArgumentException('tree data must be a collection');
          }
          // 重置键值
          $this->allNodes = collect([]);
          foreach ($data as $item) {
              $this->allNodes->put($item->{$this->getTreeNodeIdName()}, $item);
          }
  
          return $this->allNodes;
      }
docs: 获取待格式树结构的节点数据.
  
  @return mixed