public function getData() { if (\Auth::user()->idpegawai == 1) { $lembur = Lembur::join('pegawai', 'lembur.pegawai_id', '=', 'pegawai.idpegawai')->select('*'); } else { $lembur = \Auth::user()->lembur; } return Datatables::of($lembur)->editColumn('tgllembur', function ($lembur) { return $lembur->tgllembur ? with(new Carbon($lembur->tgllembur))->format('d-m-Y') : ''; })->addColumn('action', function ($lembur) { return view('pages.lembur.action', compact('lembur'))->render(); })->make(true); }