ensureCrmSubscription(); $payments = TransactionPayment::join('transactions as t', 'transaction_payments.transaction_id', '=', 't.id') ->where('t.business_id', $this->businessId()) ->where('t.contact_id', $this->contactId()) ->whereIn('t.type', ['purchase', 'purchase_return']) ->select( 'transaction_payments.*', 't.ref_no', 't.invoice_no', 't.type as transaction_type' ) ->orderByDesc('transaction_payments.paid_on') ->paginate(20); return view('portal::supplier.payments.index', compact('payments')); } }