middleware('guest')->except('logout'); $this->myTime = Carbon::now(); $this->day = $this->myTime->format('d'); $this->month = $this->myTime->format('m'); $this->years = '20'.$this->myTime->format('y'); } public function getLogin(){ return view('auth.login'); } public function logout(){ Auth::logout(); return redirect(url('login')); } public function postLogin(Request $r){ $username = $r->input('email'); $password = $r->input('password'); if (Auth::attempt(['email' => $username, 'password' => $password])) { $getAkses = Role::where('id',Auth::user()->role_id)->value('akses'); $capitalizeAkses = ucfirst($getAkses); $getUptName = \App\Model\Setting\UPT::where('office_id',Auth::user()->upt)->distinct()->value('office_name'); if ($getAkses == 'administrator') { Session::flash('colors', 'green'); Session::flash('icons', 'fas fa-check-circle'); Session::flash('info', 'Selamat Datang!'); Session::flash('alert', 'Hallo '.$capitalizeAkses); } else{ if ($getAkses == 'kepala-upt') { Session::flash('colors', 'green'); Session::flash('icons', 'fas fa-check-circle'); Session::flash('info', 'Pejabat UPT'); Session::flash('alert', $getUptName); } else{ Session::flash('colors', 'green'); Session::flash('icons', 'fas fa-check-circle'); Session::flash('info', $capitalizeAkses); Session::flash('alert', $getUptName); } } return redirect(url('/home')); } Session::flash('info', 'Terjadi Kesalahan'); Session::flash('colors', 'red'); Session::flash('icons', 'fas fa-times'); Session::flash('alert', 'Username/Password salah'); return redirect()->back(); } }