mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-18 03:05:01 +00:00
file routes refactoring
This commit is contained in:
@@ -102,21 +102,19 @@ class FileAccessController extends Controller
|
||||
*/
|
||||
public function get_zip($id)
|
||||
{
|
||||
$zip = Zip::where('id', $id)
|
||||
$zip = Zip::whereId($id)
|
||||
->where('user_id', Auth::id())
|
||||
->first();
|
||||
->firstOrFail();
|
||||
|
||||
$zip_path = 'zip/' . $zip->basename;
|
||||
$disk = Storage::disk('local');
|
||||
|
||||
$header = [
|
||||
return $disk->download("zip/$zip->basename", $zip->basename, [
|
||||
"Content-Type" => 'application/zip',
|
||||
"Content-Length" => Storage::disk('local')->size($zip_path),
|
||||
"Content-Length" => $disk->size("zip/$zip->basename"),
|
||||
"Accept-Ranges" => "bytes",
|
||||
"Content-Range" => "bytes 0-600/" . Storage::disk('local')->size($zip_path),
|
||||
"Content-Disposition" => "attachment; filename=" . $zip->basename,
|
||||
];
|
||||
|
||||
return Storage::disk('local')->download($zip_path, $zip->basename, $header);
|
||||
"Content-Range" => "bytes 0-600/" . $disk->size("zip/$zip->basename"),
|
||||
"Content-Disposition" => "attachment; filename=$zip->basename",
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,6 +50,8 @@ class RouteServiceProvider extends ServiceProvider
|
||||
|
||||
$this->mapMaintenanceRoutes();
|
||||
|
||||
$this->mapFileRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
@@ -74,6 +76,13 @@ class RouteServiceProvider extends ServiceProvider
|
||||
->group(base_path('routes/maintenance.php'));
|
||||
}
|
||||
|
||||
protected function mapFileRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/file.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user