Force public access to PDFs

This commit is contained in:
David Bomba 2022-01-04 12:52:17 +11:00
parent b6f382bae2
commit 538ea20437
2 changed files with 6 additions and 8 deletions

View File

@ -13,6 +13,7 @@
namespace App\Jobs\Entity; namespace App\Jobs\Entity;
use App\Exceptions\FilePermissionsFailure; use App\Exceptions\FilePermissionsFailure;
use App\Libraries\MultiDB;
use App\Models\Account; use App\Models\Account;
use App\Models\Credit; use App\Models\Credit;
use App\Models\CreditInvitation; use App\Models\CreditInvitation;
@ -101,8 +102,7 @@ class CreateEntityPdf implements ShouldQueue
public function handle() public function handle()
{ {
$start = microtime(true); MultiDB::setDb($this->company->db);
// nlog("Start ". $start);
/* Forget the singleton*/ /* Forget the singleton*/
App::forgetInstance('translator'); App::forgetInstance('translator');
@ -204,9 +204,9 @@ class CreateEntityPdf implements ShouldQueue
try{ try{
if(!Storage::disk($this->disk)->exists($path)) if(!Storage::disk($this->disk)->exists($path))
Storage::disk($this->disk)->makeDirectory($path, 0775);
Storage::disk($this->disk)->put($file_path, $pdf); Storage::disk($this->disk)->makeDirectory($path, 0775);
Storage::disk($this->disk)->put($file_path, $pdf, 'public');
} }
catch(\Exception $e) catch(\Exception $e)

View File

@ -108,11 +108,9 @@ class GenerateDeliveryNote
} }
if(!Storage::disk($this->disk)->exists($this->invoice->client->invoice_filepath($invitation))) if(!Storage::disk($this->disk)->exists($this->invoice->client->invoice_filepath($invitation)))
Storage::disk($this->disk)->makeDirectory($this->invoice->client->invoice_filepath($invitation), 0775); Storage::disk($this->disk)->makeDirectory($this->invoice->client->invoice_filepath($invitation), 0775);
Storage::disk($this->disk)->put($file_path, $pdf, 'public');
Storage::disk($this->disk)->put($file_path, $pdf);
//return Storage::disk($this->disk)->path($file_path);
return $file_path; return $file_path;
} }