2016-05-17 2 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

を持っています。 –

答えて

0

hereあなたはあなたがの `config/auth.php`ファイル内のテーブル名を変更することができます答え

// in the config/auth.php chage 
'model' => 'App\User', 
'table' => 'users', 
// to... 
'model' => 'App\Administrator', 
'table' => 'administrators', 
関連する問題