public function index(Request $request)
    {
        $currentPath = $request->get('path');
        $dir         = storage_path('app/public/' . $currentPath);
        $imageFiles  = $this->getImageFiles($dir);

        foreach (Finder::create()->in($dir)->sortByType()->directories() as $file) {
            $imageFiles->name($file->getBaseName());
        }

        $files = new Collection;
        $parts = explode('/', $currentPath);
        array_pop($parts);
        if ($parts <> '' && $currentPath <> '') {
            $files->push([
                'name'    => '.. Up',
                'relPath' => implode('/', $parts),
                'type'    => 'dir',
                'url'     => \Storage::url($currentPath),
            ]);
        }

        foreach ($imageFiles as $file) {
            $path = str_replace(storage_path('app/public/'), '', $file->getRealPath());
            $files->push([
                'name'    => $file->getFilename(),
                'relPath' => $path,
                'type'    => $file->getType(),
                'url'     => \Storage::url($path),
            ]);
        }

        return response()->json($files->groupBy('type'));
    }