test sending booking do to email

This commit is contained in:
omair saleh
2020-11-12 13:26:06 +08:00
parent 40f863e3d9
commit c3e6780cfb
+16 -14
View File
@@ -20,6 +20,7 @@ use App\SettingSupplier;
use App\Marking;
use App\User;
use PDF;
use ZipArchive;
class InvoiceController extends Controller
{
@@ -349,8 +350,8 @@ class InvoiceController extends Controller
$booking->admin_status = 7;
$booking->save();
$do = $this->generateSupplierDo($request, $booking->id);
Mail::raw( 'DO for booking no'.$booking->id.' '.$do->Output('do.pdf', 'S'), function($message) use ($do, $booking){
Mail::raw( 'DO for booking no'.$booking->id, function($message) use ($do, $booking){
$message->from('info@cief-malaysia.com');
$message->to('uldvstar@gmail.com');
$message->subject('DO for booking no'.$booking->id);
@@ -373,17 +374,7 @@ class InvoiceController extends Controller
}
public function generateSupplierDo(Request $request, $id){
if (!is_numeric($id)) {
return response()->json(["message" => "Invalid id. Id needs to be a number"], 400);
}
// Booking Exist and Belongs to User or is Admin
if ($request->user()->role === 'member') {
if (!$this->isUser($id, $request->user()->id)) {
return response()->json(['message' => 'The PO Does not belongs to you.'], 403);
}
}
public function generateSupplierDo($id){
// Generate PO
@@ -459,7 +450,18 @@ class InvoiceController extends Controller
public function customerToCIEFPO(Request $request, $id)
{
$mpdf = $this->generateSupplierDo($request, $id);
if (!is_numeric($id)) {
return response()->json(["message" => "Invalid id. Id needs to be a number"], 400);
}
// Booking Exist and Belongs to User or is Admin
if ($request->user()->role === 'member') {
if (!$this->isUser($id, $request->user()->id)) {
return response()->json(['message' => 'The PO Does not belongs to you.'], 403);
}
}
$mpdf = $this->generateSupplierDo($id);
$mpdf->Output();
}