mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:07:33 -05: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()
 | 
					    public function render()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $query = Credit::query()
 | 
					        $query = Credit::query()
 | 
				
			||||||
 | 
					            ->where('company_id', auth('contact')->user()->company->id)
 | 
				
			||||||
            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
 | 
					            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
 | 
				
			||||||
            ->paginate($this->per_page);
 | 
					            ->paginate($this->per_page);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -30,8 +30,9 @@ class InvoicesTable extends Component
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function render()
 | 
					    public function render()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $query = Invoice::query();
 | 
					        $query = Invoice::query()
 | 
				
			||||||
        $query = $query->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
 | 
					            ->where('company_id', auth('contact')->user()->company->id)
 | 
				
			||||||
 | 
					            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (in_array('paid', $this->status)) {
 | 
					        if (in_array('paid', $this->status)) {
 | 
				
			||||||
            $query = $query->orWhere('status_id', Invoice::STATUS_PAID);
 | 
					            $query = $query->orWhere('status_id', Invoice::STATUS_PAID);
 | 
				
			||||||
 | 
				
			|||||||
@ -24,6 +24,7 @@ class PaymentMethodsTable extends Component
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $query = ClientGatewayToken::query()
 | 
					        $query = ClientGatewayToken::query()
 | 
				
			||||||
            ->with('gateway_type')
 | 
					            ->with('gateway_type')
 | 
				
			||||||
 | 
					            ->where('company_id', auth('contact')->user()->company->id)
 | 
				
			||||||
            ->where('client_id', $this->client->id)
 | 
					            ->where('client_id', $this->client->id)
 | 
				
			||||||
            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
 | 
					            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
 | 
				
			||||||
            ->paginate($this->per_page);
 | 
					            ->paginate($this->per_page);
 | 
				
			||||||
 | 
				
			|||||||
@ -24,6 +24,7 @@ class PaymentsTable extends Component
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $query = Payment::query()
 | 
					        $query = Payment::query()
 | 
				
			||||||
            ->with('type', 'client')
 | 
					            ->with('type', 'client')
 | 
				
			||||||
 | 
					            ->where('company_id', auth('contact')->user()->company->id)
 | 
				
			||||||
            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
 | 
					            ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
 | 
				
			||||||
            ->paginate($this->per_page);
 | 
					            ->paginate($this->per_page);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -27,7 +27,8 @@ class QuotesTable extends Component
 | 
				
			|||||||
    public function render()
 | 
					    public function render()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $query = Quote::query()
 | 
					        $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)) {
 | 
					        if (in_array('draft', $this->status)) {
 | 
				
			||||||
            $query = $query->orWhere('status_id', Quote::STATUS_DRAFT);
 | 
					            $query = $query->orWhere('status_id', Quote::STATUS_DRAFT);
 | 
				
			||||||
 | 
				
			|||||||
@ -17,9 +17,8 @@ class RecurringInvoicesTable extends Component
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $query = RecurringInvoice::query();
 | 
					        $query = RecurringInvoice::query();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // ->whereClientId(auth()->user()->client->id) // auth()->user() null.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $query = $query
 | 
					        $query = $query
 | 
				
			||||||
 | 
					            ->where('company_id', auth('contact')->user()->company->id)
 | 
				
			||||||
            ->whereIn('status_id', [RecurringInvoice::STATUS_PENDING, RecurringInvoice::STATUS_ACTIVE, RecurringInvoice::STATUS_COMPLETED])
 | 
					            ->whereIn('status_id', [RecurringInvoice::STATUS_PENDING, RecurringInvoice::STATUS_ACTIVE, RecurringInvoice::STATUS_COMPLETED])
 | 
				
			||||||
            ->orderBy('status_id', 'asc')
 | 
					            ->orderBy('status_id', 'asc')
 | 
				
			||||||
            ->with('client')
 | 
					            ->with('client')
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user