$credentials = array(
'email' => $username,
'password' => $password,
'active' => 1,
'type' => 1, 2
);
检查类型1是否存在然后允许登录如果user_type 1不存在,用户名和密码组合检查两个,如果存在登录而没有找不到用户;
if (Auth::attempt($credentials, true)) {
//Something
}
答案 0 :(得分:0)
试试这个
if (Auth::attempt($credentials, true)) {
if(Auth::user()->type==1){
//write logic here
}else{
//write logic here
}
}