/** * Update the Administration - Job Skill. * * @Patch("admin/qualifications/skills") * * @param SkillRequest $request * @return \Illuminate\Http\RedirectResponse * @author Bertrand Kintanar */ public function update(SkillRequest $request) { $skill = $this->skill->whereId($request->get('skill_id'))->first(); if (!$skill) { return redirect()->to($request->path())->with('danger', UNABLE_RETRIEVE_MESSAGE); } try { $skill->update($request->all()); } catch (Exception $e) { return redirect()->to($request->path())->with('danger', UNABLE_UPDATE_MESSAGE); } return redirect()->to($request->path())->with('success', SUCCESS_UPDATE_MESSAGE); }
/** * Delete the skill. * * @Delete("ajax/delete-skill") * * @param SkillRequest $request * @author Bertrand Kintanar */ public function deleteAdminSkill(SkillRequest $request) { if ($request->ajax()) { $skillId = $request->get('id'); try { Skill::whereId($skillId)->delete(); print 'success'; } catch (Exception $e) { print 'failed'; } } }