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 () {