1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Scope LiveWire components to company (#3679)

This commit is contained in:
Benjamin Beganović 2020-05-09 00:21:35 +02:00 committed by GitHub
parent 2704bf2f82
commit 6e89affc93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 5 deletions

View File

@ -17,6 +17,7 @@ class CreditsTable extends Component
public function render()
{
$query = Credit::query()
->where('company_id', auth('contact')->user()->company->id)
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->paginate($this->per_page);

View File

@ -30,8 +30,9 @@ class InvoicesTable extends Component
public function render()
{
$query = Invoice::query();
$query = $query->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
$query = Invoice::query()
->where('company_id', auth('contact')->user()->company->id)
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
if (in_array('paid', $this->status)) {
$query = $query->orWhere('status_id', Invoice::STATUS_PAID);

View File

@ -24,6 +24,7 @@ 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);

View File

@ -24,6 +24,7 @@ class PaymentsTable extends Component
{
$query = Payment::query()
->with('type', 'client')
->where('company_id', auth('contact')->user()->company->id)
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->paginate($this->per_page);

View File

@ -27,7 +27,8 @@ class QuotesTable extends Component
public function render()
{
$query = Quote::query()
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->where('company_id', auth('contact')->user()->company->id);
if (in_array('draft', $this->status)) {
$query = $query->orWhere('status_id', Quote::STATUS_DRAFT);

View File

@ -17,9 +17,8 @@ class RecurringInvoicesTable extends Component
{
$query = RecurringInvoice::query();
// ->whereClientId(auth()->user()->client->id) // auth()->user() null.
$query = $query
->where('company_id', auth('contact')->user()->company->id)
->whereIn('status_id', [RecurringInvoice::STATUS_PENDING, RecurringInvoice::STATUS_ACTIVE, RecurringInvoice::STATUS_COMPLETED])
->orderBy('status_id', 'asc')
->with('client')