diff --git a/app/Http/Controllers/VendorPortal/InvitationController.php b/app/Http/Controllers/VendorPortal/InvitationController.php index bcc37db58dcf..9c20dab32620 100644 --- a/app/Http/Controllers/VendorPortal/InvitationController.php +++ b/app/Http/Controllers/VendorPortal/InvitationController.php @@ -111,7 +111,7 @@ class InvitationController extends Controller // $file = CreateRawPdf::dispatchNow($invitation, $invitation->company->db); - $file = (new CreatePurchaseOrderPdf($invitation))->handle(); + $file = (new CreatePurchaseOrderPdf($invitation))->rawPdf(); $headers = ['Content-Type' => 'application/pdf']; diff --git a/app/Jobs/Vendor/CreatePurchaseOrderPdf.php b/app/Jobs/Vendor/CreatePurchaseOrderPdf.php index fde78e220368..f1433484db6a 100644 --- a/app/Jobs/Vendor/CreatePurchaseOrderPdf.php +++ b/app/Jobs/Vendor/CreatePurchaseOrderPdf.php @@ -88,6 +88,32 @@ class CreatePurchaseOrderPdf implements ShouldQueue } public function handle() + { + + $pdf = $this->rawPdf(); + + if ($pdf) { + + try{ + + if(!Storage::disk($this->disk)->exists($path)) + Storage::disk($this->disk)->makeDirectory($path, 0775); + + Storage::disk($this->disk)->put($file_path, $pdf, 'public'); + + } + catch(\Exception $e) + { + + throw new FilePermissionsFailure($e->getMessage()); + + } + } + + return $file_path; + } + + public function rawPdf() { MultiDB::setDb($this->company->db); @@ -191,25 +217,8 @@ class CreatePurchaseOrderPdf implements ShouldQueue info($maker->getCompiledHTML()); } - if ($pdf) { + return $pdf; - try{ - - if(!Storage::disk($this->disk)->exists($path)) - Storage::disk($this->disk)->makeDirectory($path, 0775); - - Storage::disk($this->disk)->put($file_path, $pdf, 'public'); - - } - catch(\Exception $e) - { - - throw new FilePermissionsFailure($e->getMessage()); - - } - } - - return $file_path; } public function failed($e)