public function balance($id, $balance, $month, $year) { $date = $year . '-' . $month . '-' . '01'; $account_exists = Useraccount::where('user_id', $id)->where('fooddate', $date)->count(); if (!$account_exists) { $accounts = new Useraccount(); $accounts->user_id = $id; $accounts->fooddate = $date; $accounts->foodamount = $balance; $accounts->houserentdate = $date; $accounts->save(); Flash::message('আপনার ইনপুট সঠিক ভাবে গ্রহন করা হয়েছে।'); return redirect('/useraccounts'); } return redirect('/useraccounts')->withErrors('ইতিমধ্যেই আপনি এটা ইনপুট দিয়েছেন!'); }
public function index(Request $request) { $month = $request->month; $year = $request->year; $monthName = date("F", mktime(0, 0, 0, $month, 10)); $accounts = Useraccount::whereMonth('houserentdate', '=', $month)->whereYear('houserentdate', '=', $year)->get(); return view('reports.monthaly', compact('accounts', 'monthName', 'year')); }
public function update(Request $request, $id) { $account = Useraccount::findOrfail($id); $account->houserentdate = $request->houserentdate; $account->houserent = $request->houserent; $account->internetbill = $request->internetbill; $account->utlitybill = $request->utlitybill; $account->buabill = $request->buabill; $account->pay = $request->pay; $account->save(); Flash::info('সঠিক ভাবে আপডেট হয়েছে।'); return redirect('/useraccounts'); }