Example #1
0
 /**
  * Delete the profile qualifications education.
  *
  * @Delete("ajax/profile/qualifications/education")
  * @Delete("ajax/pim/employee-list/{id}/qualifications/education")
  *
  * @param QualificationsEducationRequest $request
  * @author Bertrand Kintanar
  */
 public function deleteEduction(QualificationsEducationRequest $request)
 {
     if ($request->ajax()) {
         $educationId = $request->get('id');
         try {
             Education::whereId($educationId)->delete();
             print 'success';
         } catch (Exception $e) {
             print 'failed';
         }
     }
 }
 /**
  * Update the Profile - Qualifications - Education.
  *
  * @Patch("profile/qualifications/educations")
  * @Patch("pim/employee-list/{id}/qualifications/educations")
  *
  * @param QualificationsEducationRequest $request
  * @param Education $education
  * @return \Illuminate\Http\RedirectResponse
  * @author Bertrand Kintanar
  */
 public function updateEducation(QualificationsEducationRequest $request, Education $education)
 {
     $education = $education->whereId($request->get('education_id'))->first();
     if (!$education) {
         return redirect()->to(str_replace('/educations', '', $request->path()))->with('danger', UNABLE_RETRIEVE_MESSAGE);
     }
     try {
         $education->update($request->all());
     } catch (Exception $e) {
         return redirect()->to(str_replace('/educations', '', $request->path()))->with('danger', UNABLE_UPDATE_MESSAGE);
     }
     return redirect()->to(str_replace('/educations', '', $request->path()))->with('success', SUCCESS_UPDATE_MESSAGE);
 }