Purchase order decorators
This commit is contained in:
parent
36a7290679
commit
73bb2c96db
2 changed files with 28 additions and 19 deletions
|
|
@ -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'];
|
||||
|
||||
|
|
|
|||
45
app/Jobs/Vendor/CreatePurchaseOrderPdf.php
vendored
45
app/Jobs/Vendor/CreatePurchaseOrderPdf.php
vendored
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue