company->db); $this->sort_asc = false; $this->sort_field = 'date'; } public function render() { $query = RecurringInvoice::query(); $query = $query // ->with('client') ->where('client_id', auth()->guard('contact')->user()->client_id) ->where('company_id', $this->company->id) ->whereIn('status_id', [RecurringInvoice::STATUS_ACTIVE]) ->orderBy('status_id', 'asc') ->with('client') ->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc') ->withTrashed() ->where('is_deleted', false) ->paginate($this->per_page); return render('components.livewire.recurring-invoices-table', [ 'invoices' => $query, ]); } }