Пример #1
0
 /**
  * Delete the profile work-shift details.
  *
  * @Delete("ajax/profile/work-shifts/edit")
  * @Delete("ajax/pim/employee-list/{id}/work-shifts/edit")
  *
  * @param WorkShiftRequest $request
  * @author Bertrand Kintanar
  */
 public function deleteWorkShiftData(WorkShiftRequest $request)
 {
     if ($request->ajax()) {
         $WorkShiftId = $request->get('id');
         try {
             EmployeeWorkShift::whereId($WorkShiftId)->delete();
             print 'success';
         } catch (Exception $e) {
             print 'failed';
         }
     }
 }
Пример #2
0
 /**
  * Update the Administration - Work Shifts.
  *
  * @Patch("admin/job/work-shifts")
  *
  * @param WorkShiftRequest $request
  * @return \Illuminate\Http\RedirectResponse
  * @author Bertrand Kintanar
  */
 public function update(WorkShiftRequest $request)
 {
     $work_shift = $this->work_shift->whereId($request->get('work_shift_id'))->first();
     if (!$work_shift) {
         return redirect()->to($request->path())->with('danger', UNABLE_RETRIEVE_MESSAGE);
     }
     try {
         $work_shift->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);
 }