From 18e8934e7069b957149af771b2912e870a5df930 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 10 Mar 2021 12:28:12 +1100 Subject: [PATCH] Delete pdf in service rather than child job --- app/Services/Invoice/InvoiceService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index b45e5eb19b6e..66e5c176cad2 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -22,6 +22,7 @@ use App\Models\Task; use App\Services\Client\ClientService; use App\Utils\Traits\MakesHash; use Illuminate\Support\Carbon; +use Illuminate\Support\Facades\Storage; class InvoiceService { @@ -273,8 +274,9 @@ class InvoiceService public function deletePdf() { - UnlinkFile::dispatchNow(config('filesystems.default'), $this->invoice->client->invoice_filepath() . $this->invoice->number.'.pdf'); - + //UnlinkFile::dispatchNow(config('filesystems.default'), $this->invoice->client->invoice_filepath() . $this->invoice->number.'.pdf'); + Storage::disk(config('filesystems.default'))->delete($this->invoice->client->invoice_filepath() . $this->invoice->number.'.pdf'); + return $this; }