mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 05:53:58 +00:00
download billing documents
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use ZipArchive;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
@@ -23,7 +24,7 @@ class DownloadBookingDocumentLogic
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return void
|
||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(Request $request)
|
||||
@@ -47,14 +48,9 @@ class DownloadBookingDocumentLogic
|
||||
$zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y') . '_' . $booking->marking . '.pdf');
|
||||
}
|
||||
|
||||
if ($zip->close() === false) {
|
||||
exit("Error creating ZIP file");
|
||||
};
|
||||
|
||||
// Storage::download($attachment);
|
||||
File::get($attachment);
|
||||
File::delete($attachment);
|
||||
$zip->close();
|
||||
|
||||
return Response::download(File::get($attachment), $request->input('type').'.zip', ['Content-Type: application/zip']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user