From b29abdeb03340219cd1cdc1db6aa6a897d719c6d Mon Sep 17 00:00:00 2001 From: omair saleh Date: Fri, 13 Nov 2020 14:23:07 +0800 Subject: [PATCH] test sending booking do to email --- app/Http/Controllers/InvoiceController.php | 31 +--------------------- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index ee3932ca..95a448e8 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -352,33 +352,6 @@ class InvoiceController extends Controller $booking->admin_status = 7; $booking->save(); - $zipname = 'do_'.Carbon::today()->format('Y_m_d').'.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_'.Carbon::today()->format('Y_m_d').'_'.$id.'.pdf', $do->Output('do.pdf', 'S')); - } - - $zip->close(); -// $attachment = chunk_split(base64_encode(File::get($zipname))); - $attachment = public_path($zipname); - - Mail::raw( 'DO for bookings po approved on '.Carbon::today(), function($message) use ($attachment){ - $message->from('exchange@cief-malaysia.com'); - $message->to('uldvstar@gmail.com'); - $message->subject('DO for bookings on'.Carbon::today()); - - $message->attach($attachment); - }); - - File::delete($zipname); - if(!$booking) { return response()->json(['message' => 'Unable to Complete Booking. Please Approve Again'], 500); } @@ -459,9 +432,7 @@ class InvoiceController extends Controller $fontData = $defaultFontConfig['fontdata']; $mpdf = new \Mpdf\Mpdf([ - 'fontDir' => array_merge($fontDirs, [ - __DIR__ . '/custom/font/directory', - ]), + 'fontDir' => array_merge($fontDirs, [storage_path('tempdir')]), ]); $mpdf->shrink_tables_to_fit=1; $mpdf->keep_table_proportions = true;