diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 8649ccd1d749..e0e95cbc19f2 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -662,6 +662,13 @@ class InvoiceController extends BaseController case 'download': return response()->download(TempFile::path($invoice->pdf_file_path()), basename($invoice->pdf_file_path())); break; + case 'restore': + $this->invoice_repo->restore($invoice); + + if (!$bulk) { + return $this->listResponse($invoice); + } + break; case 'archive': $this->invoice_repo->archive($invoice); diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index 6a1084bec687..277b15a6b984 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -263,7 +263,7 @@ class BaseRepository //make sure we are creating an invite for a contact who belongs to the client only! $contact = ClientContact::find($invitation['client_contact_id']); - if ($model->client_id == $contact->client_id); + if ($contact && $model->client_id == $contact->client_id); { $new_invitation = $invitation_factory_class::create($model->company_id, $model->user_id); $new_invitation->{$lcfirst_resource_id} = $model->id;