Exemplo n.º 1
0
 /**
  * Update the Profile - Qualifications - Skills.
  *
  * @Patch("profile/qualifications/skills")
  * @Patch("pim/employee-list/{id}/qualifications/skills")
  *
  * @param QualificationsSkillRequest $request
  * @param EmployeeSkill $employeeSkill
  * @return \Illuminate\Http\RedirectResponse
  * @author Bertrand Kintanar
  */
 public function updateSkill(QualificationsSkillRequest $request, EmployeeSkill $employeeSkill)
 {
     $employeeSkill = $employeeSkill->whereId($request->get('employee_skill_id'))->first();
     if (!$employeeSkill) {
         return redirect()->to(str_replace('/skills', '', $request->path()))->with('danger', UNABLE_RETRIEVE_MESSAGE);
     }
     try {
         $employeeSkill->skill_id = $request->get('skill_id');
         $employeeSkill->years_of_experience = $request->get('years_of_experience') ?: null;
         $employeeSkill->comment = $request->get('skill_comment') ?: null;
         $employeeSkill->save();
     } catch (Exception $e) {
         return redirect()->to(str_replace('/skills', '', $request->path()))->with('danger', UNABLE_UPDATE_MESSAGE);
     }
     return redirect()->to(str_replace('/skills', '', $request->path()))->with('success', SUCCESS_UPDATE_MESSAGE);
 }