2016-05-17 21 views
0

我正在使用Auth来验证用户。但使用users以外的表。 而且每当我使用这个控制器功能。它显示表users不存在。对用户以外的表名使用Auth laravel

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!'); 
    } 
} 
+2

可以在'配置/ auth.php'文件更改表名。 –

回答

0

here你已经得到了答案

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