download billing documents

This commit is contained in:
omair saleh
2022-03-02 03:50:47 +08:00
parent 1446a8b34e
commit be6ebdfde8
2 changed files with 12 additions and 4 deletions
@@ -23,7 +23,7 @@ class DownloadBookingDocumentLogic
/**
* @param Request $request
* @return bool
* @return void
* @throws MalformedRequestException
*/
public function execute(Request $request)
@@ -48,7 +48,15 @@ class DownloadBookingDocumentLogic
}
$zip->close();
return Storage::disk('documents')->download('collections/' . $zip_file);
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="'.basename($attachment).'"');
header('Content-Length: ' . filesize($attachment));
flush();
readfile($attachment);
// delete file
unlink($attachment);
}
}
@@ -11,11 +11,11 @@ class DownloadBookingDocumentController
/**
* @param Request $request
* @param DownloadBookingDocumentLogic $logic
* @return bool
* @return void
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function download(Request $request, DownloadBookingDocumentLogic $logic) {
return $logic->execute($request);
$logic->execute($request);
}
}