Example #1
0
 /**
  * Delete the profile job details.
  *
  * @Delete("ajax/profile/job/edit")
  * @Delete("ajax/pim/employee-list/{id}/job/edit")
  *
  * @param JobRequest $request
  * @author Bertrand Kintanar
  */
 public function deleteJobHistory(JobRequest $request)
 {
     if ($request->ajax()) {
         $jobHistoryId = $request->get('id');
         try {
             JobHistory::whereId($jobHistoryId)->delete();
             print 'success';
         } catch (Exception $e) {
             print 'failed';
         }
     }
 }
Example #2
0
 /**
  * Updates the Profile - Job.
  *
  * @Patch("profile/job")
  * @Patch("pim/employee-list/{id}/job")
  *
  * @param JobRequest $request
  * @return \Illuminate\Http\RedirectResponse
  * @author Bertrand Kintanar
  */
 public function update(JobRequest $request)
 {
     $employee_id = $request->get('employee_id');
     $job_history = $this->job_history;
     $job_history_fillables = $job_history->getFillable();
     $current_employee_job = $job_history->getCurrentEmployeeJob($job_history_fillables, $employee_id);
     $job_request_fields = $request->only($job_history_fillables);
     if ($current_employee_job != $job_request_fields) {
         $job_history->create($job_request_fields);
     }
     $this->employee->whereId($employee_id)->update($request->only('joined_date', 'probation_end_date', 'permanency_date'));
     return redirect()->to($request->path())->with('success', SUCCESS_UPDATE_MESSAGE);
 }