/** * Input data request ganti jadwal shift. * * @return */ public function store(Request $request) { if (Auth::check()) { $req = new rModel(); $req->id_karyawan = Auth::user()->id_karyawan; $req->shift_lama = \Input::get('shiftLama'); $tgl = explode("/", \Input::get('shiftBaru')); $req->shift_baru = $tgl[2] . "-" . $tgl[0] . "-" . $tgl[1]; $req->id_shiftbaru = \Input::get('shift'); $req->alasan = \Input::get('alasan'); $req->status = "Waiting"; $req->save(); return \Redirect::to('shift'); } else { return \Redirect::to('login'); } }
/** * Input data request ganti jadwal shift. * * @return */ public function store(Request $request) { if (Auth::check()) { $req = new rModel(); $req->id_karyawan = Auth::user()->id_karyawan; $req->shift_lama = \Input::get('shiftLama'); $shift = \Input::get('shift'); $tgl = explode("/", \Input::get('tanggal')); $tanggal = $tgl[2] . "-" . $tgl[0] . "-" . $tgl[1]; $req->shift_baru = $shift . " - " . $tanggal; $req->alasan = \Input::get('alasan'); $req->status = "Waiting"; $req->save(); \DB::table('logs')->insert(['id_karyawan' => Auth::user()->id_karyawan, 'content' => Auth::user()->username . ' input data request ganti jadwal shift', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]); return \Redirect::to('shift'); } else { return \Redirect::to('login'); } }
public function update(Request $request, $id) { if (Auth::check() && Auth::user()->id_jabatan == '2') { $getNotice = Notice::byDivisi(Auth::user()->id_divisi); $data = Reqmodel::find($id); $data->status = "Accept"; $data->save(); return \Redirect::to('request'); } else { return view('errors/403'); } }
/** * Display a listing of the resource. * * @return string Data shift dan request. */ public function index() { // if (Auth::check()) { $id_karyawan = Auth::user()->id_karyawan; $today = date("Y-m-d"); $getNotice = Notice::byDivisi(Auth::user()->id_divisi); $shift = \DB::table('shift')->get(); $month_end = date('Y-m-d', strtotime('last day of this month', time())); $shiftLine = Shift::join("shift", "shift_line.id_shift", "=", "shift.id_shift")->where("id_karyawan", "=", $id_karyawan)->whereBetween("tanggal_shift", array($today, $month_end))->orderBy("id_shiftline")->get(); $req = rModel::join("shift_line", "request.shift_lama", "=", "shift_line.tanggal_shift")->where("request.id_karyawan", "=", "{$id_karyawan}")->orderBy("id", "DESC")->first(); return view('shift/index')->with("getNotice", $getNotice)->with("shift", $shift)->with("shiftLine", $shiftLine)->with("req", $req); } else { return \Redirect::to('login'); } }
/** * Display a listing of the resource. * * @return string Data shift dan request. */ public function index() { // if (Auth::check()) { $id_karyawan = Auth::user()->id_karyawan; $today = date("Y-m-d"); $getNotice = Notice::where("id_karyawan", "=", $id_karyawan)->where("tanggal", "=", $today)->get(); $shift = \DB::table('shift')->get(); $month_end = date('Y-m-d', strtotime('last day of this month', time())); $shiftLine = Shift::join("shift", "shift_line.id_shift", "=", "shift.id_shift")->where("id_karyawan", "=", $id_karyawan)->whereBetween("tanggal_shift", array($today, $month_end))->orderBy("id_shiftline")->get(); $req = rModel::where("id_karyawan", "=", $id_karyawan)->orderBy("id", "DESC")->first(); \DB::table('logs')->insert(['id_karyawan' => $id_karyawan, 'content' => Auth::user()->username . ' akses halaman daftar shift', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]); return view('shift/index')->with("getNotice", $getNotice)->with("shift", $shift)->with("shiftLine", $shiftLine)->with("req", $req); } else { return \Redirect::to('login'); } }