将Auth与用户以外的表名一起使用laravel


Using Auth with table name other than users laravel

我正在使用Auth对用户进行身份验证。但使用CCD_ 2表以外的表。每当我使用这个控制器功能时。显示表users不存在。

public function authenticate(Request $request)
 {
    $input=$request->all();
    $password=$input['password'];
    $name=$input['name'];
    if (Auth::attempt(['Name' => $name, 'Password' => $password]) ){
        return redirect()->intended('/quiz/home');
}   else 
  {
        return view('quiz.login')->with('message','Error logging in!');
    }
}

这里有答案

// in the config/auth.php chage
'model' => 'App'User',
'table' => 'users',
// to...
'model' => 'App'Administrator',
'table' => 'administrators',