/** * Update the Administration - Job Education. * * @Patch("admin/qualifications/educations") * * @param EducationRequest $request * @return \Illuminate\Http\RedirectResponse * @author Bertrand Kintanar */ public function update(EducationRequest $request) { $education = $this->education->whereId($request->get('education_id'))->first(); if (!$education) { return redirect()->to($request->path())->with('danger', UNABLE_RETRIEVE_MESSAGE); } try { $education->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 education. * * @Delete("ajax/delete-education") * * @param EducationRequest $request * @author Bertrand Kintanar */ public function deleteAdminEducation(EducationRequest $request) { if ($request->ajax()) { $educationId = $request->get('id'); try { EducationLevel::whereId($educationId)->delete(); print 'success'; } catch (Exception $e) { print 'failed'; } } }