From fa18feb8e52d005bdda789af42f7ad09e458c5e0 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 20 Jul 2016 22:53:54 +0300 Subject: [PATCH] Handle deleted account when charging renewals --- app/Console/Commands/ChargeRenewalInvoices.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/ChargeRenewalInvoices.php b/app/Console/Commands/ChargeRenewalInvoices.php index 00d07f8da6ed..1dc6e546f719 100644 --- a/app/Console/Commands/ChargeRenewalInvoices.php +++ b/app/Console/Commands/ChargeRenewalInvoices.php @@ -70,8 +70,11 @@ class ChargeRenewalInvoices extends Command foreach ($invoices as $invoice) { - // check if account has switched to free since the invoice was created + // check if account has switched to free since the invoice was created $account = Account::find($invoice->client->public_id); + if ( ! $account) { + continue; + } $company = $account->company; if ( ! $company->plan || $company->plan == PLAN_FREE) { continue;