From 19f2475fb1fde8273137d3c4e186ef279f55f805 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 10 Jun 2020 23:33:53 +1000 Subject: [PATCH 1/2] Fix for client portal displaying entire companies invoices --- app/Http/Livewire/InvoicesTable.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Livewire/InvoicesTable.php b/app/Http/Livewire/InvoicesTable.php index 5ed20a85b1..9cfe333c8b 100644 --- a/app/Http/Livewire/InvoicesTable.php +++ b/app/Http/Livewire/InvoicesTable.php @@ -30,6 +30,7 @@ class InvoicesTable extends Component public function render() { + $query = Invoice::query() ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc'); @@ -48,7 +49,7 @@ class InvoicesTable extends Component } $query = $query - ->where('company_id', auth('contact')->user()->company->id) + ->where('client_id', auth('contact')->user()->client->id) ->paginate($this->per_page); return render('components.livewire.invoices-table', [ From 915abf3d41f6202a0c9b46d84e1f29e8994009db Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 10 Jun 2020 23:35:39 +1000 Subject: [PATCH 2/2] Fixes for client portal data tables --- app/Http/Livewire/CreditsTable.php | 2 +- app/Http/Livewire/PaymentMethodsTable.php | 1 - app/Http/Livewire/PaymentsTable.php | 2 +- app/Http/Livewire/QuotesTable.php | 2 +- app/Http/Livewire/RecurringInvoicesTable.php | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Http/Livewire/CreditsTable.php b/app/Http/Livewire/CreditsTable.php index 6f51d16e53..a2b2205aa0 100644 --- a/app/Http/Livewire/CreditsTable.php +++ b/app/Http/Livewire/CreditsTable.php @@ -17,7 +17,7 @@ class CreditsTable extends Component public function render() { $query = Credit::query() - ->where('company_id', auth('contact')->user()->company->id) + ->where('client_id', auth('contact')->user()->client->id) ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc') ->paginate($this->per_page); diff --git a/app/Http/Livewire/PaymentMethodsTable.php b/app/Http/Livewire/PaymentMethodsTable.php index a8fca8c73a..8b0c798ac2 100644 --- a/app/Http/Livewire/PaymentMethodsTable.php +++ b/app/Http/Livewire/PaymentMethodsTable.php @@ -24,7 +24,6 @@ class PaymentMethodsTable extends Component { $query = ClientGatewayToken::query() ->with('gateway_type') - ->where('company_id', auth('contact')->user()->company->id) ->where('client_id', $this->client->id) ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc') ->paginate($this->per_page); diff --git a/app/Http/Livewire/PaymentsTable.php b/app/Http/Livewire/PaymentsTable.php index 0b2b3b81e7..a726128502 100644 --- a/app/Http/Livewire/PaymentsTable.php +++ b/app/Http/Livewire/PaymentsTable.php @@ -24,7 +24,7 @@ class PaymentsTable extends Component { $query = Payment::query() ->with('type', 'client') - ->where('company_id', auth('contact')->user()->company->id) + ->where('client_id', auth('contact')->user()->client->id) ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc') ->paginate($this->per_page); diff --git a/app/Http/Livewire/QuotesTable.php b/app/Http/Livewire/QuotesTable.php index d27c59bd74..9bf687da37 100644 --- a/app/Http/Livewire/QuotesTable.php +++ b/app/Http/Livewire/QuotesTable.php @@ -46,7 +46,7 @@ class QuotesTable extends Component } $query = $query - ->where('company_id', auth('contact')->user()->company->id) + ->where('client_id', auth('contact')->user()->client->id) ->paginate($this->per_page); return render('components.livewire.quotes-table', [ diff --git a/app/Http/Livewire/RecurringInvoicesTable.php b/app/Http/Livewire/RecurringInvoicesTable.php index d4e4e3dceb..68f83c4f6a 100644 --- a/app/Http/Livewire/RecurringInvoicesTable.php +++ b/app/Http/Livewire/RecurringInvoicesTable.php @@ -18,7 +18,7 @@ class RecurringInvoicesTable extends Component $query = RecurringInvoice::query(); $query = $query - ->where('company_id', auth('contact')->user()->company->id) + ->where('client_id', auth('contact')->user()->client->id) ->whereIn('status_id', [RecurringInvoice::STATUS_PENDING, RecurringInvoice::STATUS_ACTIVE, RecurringInvoice::STATUS_COMPLETED]) ->orderBy('status_id', 'asc') ->with('client')