Laravel分组用户

时间:2014-09-09 03:43:07

标签: php database laravel-4 phpmyadmin login-control

我遇到了一个问题,更多的是缺乏知识。我想将我的用户分组到我的数据库中,所以我有一个名为groups的行,其int为0-3。如果用户的值为零,那么如果用户是最基本形式的1,则不激活他/她,如果用户为2,则为管理员,3为超级管理员,但我不是知道如何检查用户是否是一个或另一个我的代码在下面。 非常感谢所有人。

public function postLogin(){
    $Validator = Validator::make(Input::all(), array(
        'email' => 'required | email',
        'password' => 'required'
        ));
    if($Validator->fails()){
        return Redirect::route('account-Login-post')
        ->withErrors($Validator)
        ->withInput();
    }
    else{
        $auth = Auth::attempt(array(
            'email' => Input::get('email'),
            'password' => Input::get('password'),
            'active' => 1,
            'groups' => 1 //I would like to check if the user has a value of 1-3 not just one.
            ));
        if($auth){
            return Redirect::intended('/');
        }

    }

    return Redirect::route('account-Login-post')
    ->with('global',"sorry");
}

0 个答案:

没有答案
相关问题