Ensure directories are created prior to PDF generation

This commit is contained in:
David Bomba 2021-06-13 10:18:07 +10:00
parent 06ee04ffa5
commit 7709bd32d1
4 changed files with 13 additions and 4 deletions

View File

@ -480,7 +480,11 @@ class CompanyExport implements ShouldQueue
$file_name = date('Y-m-d').'_'.str_replace(' ', '_', $this->company->present()->name() . '_' . $this->company->company_key .'.zip');
Storage::makeDirectory(public_path('storage/backups/'), 0775);
$path = public_path('storage/backups/');
if(!Storage::exists($path))
Storage::makeDirectory($path, 0775);
$zip_path = public_path('storage/backups/'.$file_name);
$zip = new \ZipArchive();

View File

@ -193,7 +193,8 @@ class CreateEntityPdf implements ShouldQueue
try{
nlog($file_path);
if(!Storage::exists($path))
Storage::makeDirectory($path, 0775);
Storage::disk($this->disk)->put($file_path, $pdf);

View File

@ -106,6 +106,9 @@ class GenerateDeliveryNote
info($maker->getCompiledHTML());
}
if(!Storage::exists($this->invoice->client->invoice_filepath($invitation)))
Storage::makeDirectory($this->invoice->client->invoice_filepath($invitation), 0775);
Storage::disk($this->disk)->put($file_path, $pdf);
return Storage::disk($this->disk)->path($file_path);

View File

@ -90,6 +90,9 @@ class Phantom
$this->checkMime($pdf, $invitation, $entity);
if(!Storage::exists($path))
Storage::makeDirectory($path, 0775);
$instance = Storage::disk(config('filesystems.default'))->put($file_path, $pdf);
return $file_path;
@ -118,8 +121,6 @@ class Phantom
$finfo = new \finfo(FILEINFO_MIME);
nlog($pdf);
if($finfo->buffer($pdf) != 'application/pdf; charset=binary')
{
SystemLogger::dispatch(