/** * 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); }
/** * Delete the nationality. * * @Delete("ajax/delete-work-shift") * * @param WorkShiftRequest $request * @author Bertrand Kintanar */ public function deleteWorkShift(WorkShiftRequest $request) { if ($request->ajax()) { $workShiftId = $request->get('id'); try { WorkShift::whereId($workShiftId)->delete(); print 'success'; } catch (Exception $e) { print 'failed'; } } }