Esempio n. 1
0
 /**
  * Delete the profile qualifications skill.
  *
  * @Delete("ajax/profile/qualifications/skill")
  * @Delete("ajax/pim/employee-list/{id}/qualifications/skill")
  *
  * @param QualificationsSkillRequest $request
  * @author Bertrand Kintanar
  */
 public function deleteSkill(QualificationsSkillRequest $request)
 {
     if ($request->ajax()) {
         $employeeSkillId = $request->get('id');
         try {
             EmployeeSkill::whereId($employeeSkillId)->delete();
             print 'success';
         } catch (Exception $e) {
             print 'failed';
         }
     }
 }
Esempio n. 2
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);
 }