public function updateAll()
 {
     $forUpdateArr = Input::get('_id');
     if (!empty($forUpdateArr)) {
         foreach ($forUpdateArr as $id => $value) {
             $goalSet = GoalManagement::whereRaw('user_id = ?', array($id))->first();
             $goalSet->jan = $this->getInputValue('jan', $id);
             $goalSet->feb = $this->getInputValue('feb', $id);
             $goalSet->mar = $this->getInputValue('mar', $id);
             $goalSet->apr = $this->getInputValue('apr', $id);
             $goalSet->may = $this->getInputValue('may', $id);
             $goalSet->jun = $this->getInputValue('jun', $id);
             $goalSet->jul = $this->getInputValue('jul', $id);
             $goalSet->aug = $this->getInputValue('aug', $id);
             $goalSet->sep = $this->getInputValue('sep', $id);
             $goalSet->oct = $this->getInputValue('oct', $id);
             $goalSet->nov = $this->getInputValue('nov', $id);
             $goalSet->dec = $this->getInputValue('dec', $id);
             $goalSet->annual = $this->compAnnual($goalSet);
             $goalSet->save();
         }
     }
     $keyword = '';
     $message = 'Goals have been updated. ';
     $users = $this->getActiveCompanyUsers(null);
     if (count($users) == 25) {
         $message . " There are more users than are currently displayed. Please use the search filter.";
     }
     return view('goalSettings.list', compact('users', 'keyword', 'message'));
 }
 public function getDirectHireTarget($user_id)
 {
     $user_id = $user_id == null ? Auth::user()->id : $user_id;
     $data = GoalManagement::where('user_id', '=', $user_id)->first();
     return $data;
 }
Пример #3
0
                 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();