return abort(403);
}
ProducePackage::dispatchSync();
-
- $path = storage_path('package.zip');
-
- if (file_exists($path)) {
- return response(null)->header('Content-Disposition', 'attachment;filename=package.zip')->header('Content-Type', Files::_getMimeType($path))->header('X-Sendfile', $path);
- } else {
- return response(null)->setStatusCode(404);
- }
+ return redirect(backpack_url('tools/packagedownloadfile'));
}
}
--- /dev/null
+<?php
+
+namespace App\Http\Controllers\Tools;
+
+use App\Jobs\ProducePackage;
+
+trait PackageDownloadFile
+{
+ protected function packagedownload() {
+ if(!can('package')){
+ return abort(403);
+ }
+
+ $path = storage_path('package.zip');
+
+ if (file_exists($path)) {
+ return response(null)->header('Content-Disposition', 'attachment;filename=package.zip')->header('Content-Type', Files::_getMimeType($path))->header('X-Sendfile', $path);
+ } else {
+ return response(null)->setStatusCode(404);
+ }
+ }
+}