public function generateCode() { $last = Lpd::select('kode')->orderBy('kode', 'desc')->first(); if (empty($last['kode'])) { return "LPD0001"; } else { $no = str_replace('LPD', '', $last['kode']); $no = (int) $no + 1; $new = 'LPD' . str_pad($no, 4, '0', STR_PAD_LEFT); return $new; } }
public function homepage() { $rpds = Rpd::mine()->where('status', 'BACK TO INITIATOR')->orWhere('status', 'SUBMIT')->paginate(10); $lpds = Lpd::mine()->where('status', 'BACK TO INITIATOR')->orWhere('status', 'SUBMIT')->orWhere('status', 'TAKE PAYMENT')->where('status', 'BACK TO INITIATOR')->orWhere('status', 'PROCESS PAYMENT')->paginate(10); return view('homepage', compact('rpds', 'lpds')); }