mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Scope LiveWire components to company (#3679)
This commit is contained in:
parent
2704bf2f82
commit
6e89affc93
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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')
|
||||
|
Loading…
x
Reference in New Issue
Block a user