app/Models/Traits/SelectHierarchyTrait.php
public static function getSelectHierarchy($belongsTo = null)
    {
        $query = static::roots();

        if (!is_null($belongsTo)) {
            $query->where('belongs_to', $belongsTo);
        }

        $roots = $query->with('children')->get();

        $options = [0 => 'None'];

        foreach ($roots as $root) {
            $options = $options + static::getRenderedNode($root);
        }

        return $options;
    }
public static function getSelectHierarchy($belongsTo = null)
    {
        $query = static::roots();

        if (!is_null($belongsTo)) {
            $query->where('belongs_to', $belongsTo);
        }

        $roots = $query->with('children')->get();

        $options = [0 => 'None'];

        foreach ($roots as $root) {
            $options = $options + static::getRenderedNode($root);
        }

        return $options;
    }
Returns the complete nested set table in a nested list.

@param string $belongsTo

@return array