src/Leevel/Tree/Tree.php
protected function getParentsReal($id): array
    {
        if (!array_key_exists($id, $this->map)) {
            return [];
        }

        $data = [];

        if (array_key_exists($this->map[$id], $this->map)) {
            $data[] = $this->map[$id];
            $data = array_merge($data, $this->getParentsReal($this->map[$id]));
        }

        return $data;
    }
protected function getParentsReal($id): array
    {
        if (!array_key_exists($id, $this->map)) {
            return [];
        }

        $data = [];

        if (array_key_exists($this->map[$id], $this->map)) {
            $data[] = $this->map[$id];
            $data = array_merge($data, $this->getParentsReal($this->map[$id]));
        }

        return $data;
    }
取得给定 ID 所有父级 ID.

@param int|string $id

@return array