/**
  * Update the Administration - Job Employment Status.
  *
  * @Patch("admin/job/employment-status")
  *
  * @param EmploymentStatusRequest $request
  * @return \Illuminate\Http\RedirectResponse
  * @author Bertrand Kintanar
  */
 public function update(EmploymentStatusRequest $request)
 {
     $employment_status = $this->employment_status->whereId($request->get('employment_status_id'))->first();
     if (!$employment_status) {
         return redirect()->to($request->path())->with('danger', UNABLE_RETRIEVE_MESSAGE);
     }
     try {
         $employment_status->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);
 }
Exemple #2
0
 /**
  * Delete the employment status.
  *
  * @Delete("ajax/delete-employment-status")
  *
  * @param EmploymentStatusRequest $request
  * @author Bertrand Kintanar
  */
 public function deleteEmploymentStatus(EmploymentStatusRequest $request)
 {
     if ($request->ajax()) {
         $employmentStatusId = $request->get('id');
         try {
             EmploymentStatus::whereId($employmentStatusId)->delete();
             print 'success';
         } catch (Exception $e) {
             print 'failed';
         }
     }
 }