From 3b86d39e1d9ce0447eeb27624a360040b3c8490e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 26 Oct 2023 13:47:46 +1100 Subject: [PATCH] remove redundant code paths --- app/Models/Credit.php | 49 ------------------------------------------- 1 file changed, 49 deletions(-) diff --git a/app/Models/Credit.php b/app/Models/Credit.php index 1adcdb89a8ca..6ba2d7b18b53 100644 --- a/app/Models/Credit.php +++ b/app/Models/Credit.php @@ -16,7 +16,6 @@ use Illuminate\Support\Carbon; use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesDates; use App\Helpers\Invoice\InvoiceSum; -// use App\Jobs\Entity\CreateEntityPdf; use App\Utils\Traits\MakesReminders; use App\Services\Credit\CreditService; use App\Services\Ledger\LedgerService; @@ -358,54 +357,6 @@ class Credit extends BaseModel $this->saveQuietly(); } - /** @deprecated 5.7 */ - public function pdf_file_path($invitation = null, string $type = 'path', bool $portal = false) - { - if (! $invitation) { - if ($this->invitations()->exists()) { - $invitation = $this->invitations()->first(); - } else { - $this->service()->createInvitations(); - $invitation = $this->invitations()->first(); - } - } - - if (! $invitation) { - throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?'); - } - - $file_path = $this->client->credit_filepath($invitation).$this->numberFormatter().'.pdf'; - - if (Ninja::isHosted() && $portal && Storage::disk(config('filesystems.default'))->exists($file_path)) { - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } elseif (Ninja::isHosted() && $portal) { - // $file_path = (new CreateEntityPdf($invitation, config('filesystems.default')))->handle(); - - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } - - $file_exists = false; - - try { - $file_exists = Storage::disk(config('filesystems.default'))->exists($file_path); - } catch (\Exception $e) { - nlog($e->getMessage()); - } - - if ($file_exists) { - return Storage::disk(config('filesystems.default'))->{$type}($file_path); - } - - - if (Storage::disk('public')->exists($file_path)) { - return Storage::disk('public')->{$type}($file_path); - } - - // $file_path = (new CreateEntityPdf($invitation))->handle(); - - return Storage::disk('public')->{$type}($file_path); - } - public function markInvitationsSent() { $this->invitations->each(function ($invitation) {