2016-05-17 24 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',