两个特定的user_type匹配用户laravel

时间:2018-05-08 11:38:25

标签: laravel

$credentials = array(
                'email' => $username,
                'password' => $password,
                'active' => 1,
                'type' => 1, 2
            );

检查类型1是否存在然后允许登录如果user_type 1不存在,用户名和密码组合检查两个,如果存在登录而没有找不到用户;

if (Auth::attempt($credentials, true)) {
    //Something
}

1 个答案:

答案 0 :(得分:0)

试试这个

if (Auth::attempt($credentials, true)) {
   if(Auth::user()->type==1){
      //write logic here
   }else{
     //write logic here
   }
}