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('ইতিমধ্যেই আপনি এটা ইনপুট দিয়েছেন!'); }