From dade97fbfae32fc478764f77c31e4affdda77266 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 29 Feb 2016 13:25:32 +0200 Subject: [PATCH] Merged minor fixes --- app/Ninja/Repositories/AccountRepository.php | 12 +++++------- app/Services/ImportService.php | 2 +- resources/views/accounts/bank_account.blade.php | 1 + resources/views/header.blade.php | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index 2b469bf0fcf7..62c924d545da 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -124,25 +124,23 @@ class AccountRepository return false; } - $client = $this->getNinjaClient(Auth::user()->account); - $invitation = $this->createNinjaInvoice($client); - + $account = Auth::user()->account; + $client = $this->getNinjaClient($account); + $invitation = $this->createNinjaInvoice($client, $account); return $invitation; } - - public function createNinjaInvoice($client) + public function createNinjaInvoice($client, $clientAccount) { $account = $this->getNinjaAccount(); $lastInvoice = Invoice::withTrashed()->whereAccountId($account->id)->orderBy('public_id', 'DESC')->first(); $publicId = $lastInvoice ? ($lastInvoice->public_id + 1) : 1; - $invoice = new Invoice(); $invoice->account_id = $account->id; $invoice->user_id = $account->users()->first()->id; $invoice->public_id = $publicId; $invoice->client_id = $client->id; $invoice->invoice_number = $account->getNextInvoiceNumber($invoice); - $invoice->invoice_date = Auth::user()->account->getRenewalDate(); + $invoice->invoice_date = $clientAccount->getRenewalDate(); $invoice->amount = PRO_PLAN_PRICE; $invoice->balance = PRO_PLAN_PRICE; $invoice->save(); diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index b557e067b2bf..c17a8e359a80 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -1,4 +1,4 @@ -