예제 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (\Auth::user()->idpegawai == 1) {
         $cuti = \App\Cuti::where('status', 'Pending')->count();
         $lembur = \App\Lembur::where('status', 'Pending')->count();
     } else {
         $cuti = \App\Cuti::where('tglawal', '>', Carbon::now())->where('status', 'Accepted')->where('pegawai_id', \Auth::user()->idpegawai)->count();
         $lembur = \App\Lembur::where('tgllembur', '>', Carbon::now()->subWeek())->where('tgllembur', '<', Carbon::now())->where('status', 'Accepted')->where('pegawai_id', \Auth::user()->idpegawai)->count();
         $training = \Auth::user()->training()->future()->count();
     }
     return view('pages/dashboard/dashboard', compact('cuti', 'lembur', 'training'));
 }
예제 #2
0
 public function decline($idlembur)
 {
     $lembur = Lembur::findOrFail($idlembur);
     $lembur->status = 'Declined';
     $lembur->save();
     flash()->overlay('Lembur telah ditolak!');
     return redirect('lembur');
 }