public function delete_file_folder(Request $request)
    {
        $folderLocation = $request->folder_location;
        $fileFolder = $request->file_folder;
        $type = $request->type;
        $success = true;
        $error = '';

        if (is_array($folderLocation)) {
            $folderLocation = rtrim(implode('/', $folderLocation), '/');
        }

        $location = "{$this->directory}/{$folderLocation}";
        $fileFolder = "{$location}/{$fileFolder}";

        if ($type == 'folder') {
            if (!Storage::disk($this->filesystem)->deleteDirectory($fileFolder)) {
                $error = __('admin.media.error_deleting_folder');
                $success = false;
            }
        } elseif (!Storage::disk($this->filesystem)->delete($fileFolder)) {
            $error = __('admin.media.error_deleting_file');
            $success = false;
        }

        return compact('success', 'error');
    }
public function delete_file_folder(Request $request)
    {
        $folderLocation = $request->folder_location;
        $fileFolder = $request->file_folder;
        $type = $request->type;
        $success = true;
        $error = '';

        if (is_array($folderLocation)) {
            $folderLocation = rtrim(implode('/', $folderLocation), '/');
        }

        $location = "{$this->directory}/{$folderLocation}";
        $fileFolder = "{$location}/{$fileFolder}";

        if ($type == 'folder') {
            if (!Storage::disk($this->filesystem)->deleteDirectory($fileFolder)) {
                $error = __('admin.media.error_deleting_folder');
                $success = false;
            }
        } elseif (!Storage::disk($this->filesystem)->delete($fileFolder)) {
            $error = __('admin.media.error_deleting_file');
            $success = false;
        }

        return compact('success', 'error');
    }
public function delete_file_folder ( Request $ request ) { $ folderLocation = $ request -> folder_location ; $ fileFolder = $ request -> file_folder ; $ type = $ request -> type ; $ success = true ; $ error = '' ; if ( is_array ( $ folderLocation ) ) { $ folderLocation = rtrim ( implode ( '/' , $ folderLocation ) , '/' ) ; } $ location = "{$this->directory}/{$folderLocation}" ; $ fileFolder = "{$location}/{$fileFolder}" ; if ( $ type == 'folder' ) { if ( ! Storage :: disk ( $ this -> filesystem ) -> deleteDirectory ( $ fileFolder ) ) { $ error = __ ( 'admin.media.error_deleting_folder' ) ; $ success = false ; } } elseif ( ! Storage :: disk ( $ this -> filesystem ) -> delete ( $ fileFolder ) ) { $ error = __ ( 'admin.media.error_deleting_file' ) ; $ success = false ; } return compact ( 'success' , 'error' ) ; }
Delete File or Folder with 5.3
Delete File or Folder with 5 . 3