ensurePortalAccess(); $contact = Contact::where('business_id', $this->businessId()) ->find($this->contactId()); return view('portal::supplier.ledger.index', compact('contact')); } public function getLedger() { $this->ensurePortalAccess(); $start_date = request()->start_date; $end_date = request()->end_date; $crm_contact_id = $this->contactId(); $contact = Contact::where('business_id', $this->businessId()) ->find($crm_contact_id); $ledger_details = $this->transactionUtil->getLedgerDetails($crm_contact_id, $start_date, $end_date); if (request()->input('action') == 'pdf') { $for_pdf = true; $html = view('contact.ledger') ->with(compact('ledger_details', 'contact', 'for_pdf'))->render(); $mpdf = $this->getMpdf(); $mpdf->WriteHTML($html); $mpdf->Output(); } return view('contact.ledger') ->with(compact('ledger_details', 'contact')); } }