/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(Requests\SaveGoalSettingRequest $request, $id) { $goalSetting = GoalManagement::findOrFail($id); $goalSetting->annual = $this->calculateAnnual($request); $goalSetting->update($request->all()); $message = 'Goals for ' . $goalSetting->user->last_name . ', ' . $goalSetting->user->first_name . ' have successfully Updated '; $users = $this->getActiveCompanyUsers(null); $keyword = ''; return view('goalSettings.list', compact('users', 'message', 'keyword')); }
break; case "nov": $goalManagements->nov = $amount; break; case "dic": $goalManagements->dic = $amount; break; } $goalManagements->annual = $goalManagements->jan + $goalManagements->feb + $goalManagements->mar + $goalManagements->apr + $goalManagements->may + $goalManagements->jun + $goalManagements->jul + $goalManagements->aug + $goalManagements->sep + $goalManagements->oct + $goalManagements->nov + $goalManagements->dec; $goalManagements->save(); echo "true"; } else { echo "false"; } } else { $goalManagements = \App\GoalManagement::findOrFail($id_goals_managers); if ($goalManagements) { $goalManagements->annual = $amount; $goalManagements->jan = $amount / 12; $goalManagements->feb = $amount / 12; $goalManagements->mar = $amount / 12; $goalManagements->apr = $amount / 12; $goalManagements->may = $amount / 12; $goalManagements->jun = $amount / 12; $goalManagements->jul = $amount / 12; $goalManagements->aug = $amount / 12; $goalManagements->sep = $amount / 12; $goalManagements->oct = $amount / 12; $goalManagements->nov = $amount / 12; $goalManagements->dec = $amount / 12; $goalManagements->save();