Laravel Vapor - sync code for download files in bulk from S3

This commit is contained in:
Dillon Ngo
2024-05-26 19:45:37 +08:00
parent 2c2815476f
commit 5885ff16e5
@@ -30,8 +30,20 @@ class DownloadBookingDocumentLogic
{
Auth::login(User::findOrFail(1));
$document_type = str_replace(' ', '', $request->input('type'));
$zipDirectory = storage_path('/app/documents/collections');
if (!file_exists($zipDirectory)) {
mkdir($zipDirectory, 0755, true);
}
$zip_file = $document_type.'.zip';
$attachment = storage_path().'/app/documents/collections/' . $zip_file;
Log::info('attachment 1: '. $attachment);
$attachment = "{$zipDirectory}/{$zip_file}";
Log::info('attachment 2: '. $attachment);
$bookings = Booking::where('status', ApprovalStatus::COMPLETED)
->whereDate('created_at', '>=', Carbon::parse($request->input('startDate')))