2017-11-06 5 views
0

アップグレードLaravel。は5.0 5.1へのログインの問題

旧コンストラクタ:

public function __construct(Guard $auth, Registrar $registrar) 
{ 
    $this->auth = $auth; 
    $this->registrar = $registrar; 

    $this->middleware('guest', ['except' => 'getLogout']); 
} 

新しいコンストラクタ:

public function __construct() 
{ 
    $this->middleware('guest', ['except' => 'getLogout']); 
} 

そして、ここでは、私が$this->auth->login($user)を変更する必要がありますどのように$this->auth->login($user);

public function getConfirmation($confirmationCode = null) 
{ 
    if ($confirmationCode) { 
     $user = User::where('confirmation_code', '=', $confirmationCode)->first(); 

     if ($user) { 
      $user->update([ 
       'confirmed'   => 1, 
       'confirmation_code' => null 
      ]); 

      $this->auth->login($user); 
      return redirect()->action('[email protected]_page', $user->name); 
     } 
    } 

    return view('auth.confirm'); 
} 

に動作しないのですか?

+0

からAuthファサードを追加する必要がない場合は、キャッシュ& '作曲ダンプautoload'をクリアしようとしていますか? – Webinion

+1

は認証::ログイン($ユーザ)は動作しません何 – HasilT

+0

を試してみてください?それがスローする例外を与えてください。 –

答えて

1

あなたはファサードを使用することができます。だから、 https://laravel.com/docs/5.1/authentication#other-authentication-methods

:私はファサードはデフォルトでconfig/app.phpにある場合ので、私は知らないlaravel 5.2で開始

use Auth; // Of course use the Facade. 

... 

Auth::login($user); 

。あなたはconfig/app.php

関連する問題