public function authen() { $user = array('ma_so_the' => Input::get('username'), 'password' => Input::get('password')); // if (NguoiDung::validateBanner($user['ma_so_the'])) { $validation = NguoiDung::validate($user); if ($validation->passes()) { if (Auth::attempt($user)) { switch (Auth::user()->id_nhom_quyen_han) { case 1: Session::put('role', 'quan_ly'); General::storeevents(NGUOI_DUNG_LOGIN + " với quyền hạn quản lý"); break; case 2: Session::put('role', 'thu_thu'); General::storeevents(NGUOI_DUNG_LOGIN + " với quyền hạn thủ thư"); break; case 3: case 4: Session::put('role', 'nguoi_muon'); General::storeevents(NGUOI_DUNG_LOGIN + " với quyền hạn người mượn"); break; } return Redirect::to('/'); } return Redirect::route('login')->with('error_message', 'Tài khoản hoặc mật khẩu không chính xác!')->withInput(); } else { return Redirect::route('login')->withErrors($validation)->withInput(); } } else { return Redirect::route('login')->withInput()->with('error_message', 'Tài khoản của bạn tạm thời đã bị khóa!'); } }
public static function getMaxIdUser() { $id = NguoiDung::max('id'); return $id; }
public static function getDonVi($mst) { $DonVi = NguoiDung::select('don_vi_cong_tac')->where('ma_so_the', $mst)->get(); return $DonVi[0]->don_vi_cong_tac; }