mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 04:24:16 +00:00
download billing documents
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
|
||||
use Illuminate\Support\Facades\File;
|
||||
use ZipArchive;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
@@ -19,7 +20,7 @@ class DownloadBookingDocumentLogic
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
* @return void
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(Request $request)
|
||||
@@ -44,10 +45,23 @@ class DownloadBookingDocumentLogic
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
while (ob_get_level()) {
|
||||
ob_end_clean();
|
||||
}
|
||||
ob_start();
|
||||
header($_SERVER['SERVER_PROTOCOL'] . ' 200 OK');
|
||||
header("Content-Type: application/zip");
|
||||
header("Content-Transfer-Encoding: Binary");
|
||||
header("Content-Length: " . filesize($attachment));
|
||||
header('Pragma: no-cache');
|
||||
header("Content-Disposition: attachment; filename=\"" . basename($attachment) . "\"");
|
||||
ob_flush();
|
||||
ob_clean();
|
||||
|
||||
$headers = array('Content-Type'=>'application/octet-stream',);
|
||||
$zip_new_name = $request->input('type').".zip";
|
||||
return response()->download($attachment,$zip_new_name,$headers)->deleteFileAfterSend(true);
|
||||
readfile($attachment);
|
||||
File::delete($attachment);
|
||||
|
||||
exit;
|
||||
|
||||
// header('Content-Type: application/zip');
|
||||
// header('Content-Length: ' . filesize($attachment));
|
||||
|
||||
@@ -11,7 +11,7 @@ class DownloadBookingDocumentController
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DownloadBookingDocumentLogic $logic
|
||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function download(Request $request, DownloadBookingDocumentLogic $logic) {
|
||||
|
||||
Reference in New Issue
Block a user