From a3a94cfd65ca17e457a18f4ec29d2261b2e1392e Mon Sep 17 00:00:00 2001 From: omair saleh Date: Thu, 12 Nov 2020 13:22:57 +0800 Subject: [PATCH] test sending booking do to email --- routes/web.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/routes/web.php b/routes/web.php index 0081fd68..4082d400 100644 --- a/routes/web.php +++ b/routes/web.php @@ -46,6 +46,22 @@ Route::get('/old-invoices', function(){ } })->name('invoice.old'); +Route::get('/approved-today', function(){ + $zipname = 'do_12_11_2020_01.zip'; + $zip = new ZipArchive; + $zip->open($zipname, ZipArchive::CREATE); + $approvedInvoices = InvoiceStatuses::where('status', 'approve')->whereDate('created_at', Carbon::today())->distinct()->get(['invoice_id']); + $bookings = []; + foreach($approvedInvoices as $approved){ + $bookings[] = $approved->invoice->booking->id; + } + foreach ($bookings as $id) { + $do = $this->generateSupplierDo($id); + $zip->addFromString('do_12_11_2020_'.$id, $do); + } + $zip->getStream('test.zip'); + $zip->close(); +}); Route::group(['middleware' => ['role:admin']], function() { Route::get('bulkBookings', function () {