protected function buildDirectory($directories, $parent)
    {
        $directories = $directories->map(function ($dir) use ($parent) {
            $dir = str_replace($parent . '/', '', $dir);

            return $dir;
        });

        $html = '<ul>';
        $directories->each(function ($dir) use (&$html, $parent) {
            $subParent = $parent . '/' . $dir;
            $url       = request()->url() . '?folder=' . $dir;

            $dir  = str_replace('public/', 'storage/', $dir);
            $html .= "<li>";
            $html .= "<a href='{$url}'>{$dir}</a>";
            if ($child = $this->scanDirectory($subParent)) {
                $html .= $this->buildDirectory($child, $subParent);
            }
            $html .= "</li>";
        });
        $html .= '</ul>';

        return $html;
    }