From f9256eafb4d4a7f273e6f4bd9f0b52d30da9e334 Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 25 Nov 2021 01:08:27 +0800 Subject: [PATCH] add command for sending do to vt --- app/Console/Commands/EmailDoToVTCommand.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/EmailDoToVTCommand.php b/app/Console/Commands/EmailDoToVTCommand.php index aa5c7cf0..6dd8e6b6 100644 --- a/app/Console/Commands/EmailDoToVTCommand.php +++ b/app/Console/Commands/EmailDoToVTCommand.php @@ -60,8 +60,9 @@ class EmailDoToVTCommand extends Command { Auth::login(User::findOrFail(1)); $zip_file = 'do_from_11_nov_to_23_nov.zip'; + $attachment = storage_path('temp').'/'.$zip_file; $zip = new ZipArchive(); - if ($zip->open(storage_path().'/'.$zip_file, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)) { + if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)) { $bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', Carbon::parse('12-11-2021'))->whereDate('updated_at', '<=', Carbon::parse('23-11-2021')) ->whereHas('transactions', function ($query){ @@ -76,9 +77,9 @@ class EmailDoToVTCommand extends Command echo 'Could not add file to ZIP: ' . $file; } } -dd($zip); + $zip->close(); - $attachment = storage_path().'/'.$zip_file; + Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION from 12-11-2021 to 23-11-2021.\r\n\r\n**This is an automatically generated email – please do not reply to it. If you have any queries kindly contact our admin team through Wechat.\r\n\r\n\r\nCIEF WORLDWIDE SDN BHD", function($message) use ($attachment){ $message->from('exchange@cief-malaysia.com');