2014-04-22 219 views
0

我在做一個使用Laravel的應用程序,並且正在做一個登錄系統。 在登錄我沒有任何問題,但是在退出瀏覽器獲得一個錯誤Laravel登錄系統

Whoops, looks like something went wrong. 

我的登錄功能

public function postSignin() { 
    if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')))) { 
     return Redirect::to('users/dashboard')->with('message', 'You are now logged in!'); 
    } else { 
     return Redirect::to('users/login') 
      ->with('message', 'Your username/password combination was incorrect') 
      ->withInput(); 
    } 
} 

我的註銷功能

public function getLogout() { 
    Auth::logout(); 
    return Redirect::to('users/login')->with('message', 'Your are now logged out!'); 
} 

如果我刪除行Auth::logout();頁面被重定向,但我不能使用Auth::check()來驗證用戶是否已登錄。

在發生錯誤Whoops, looks like something went wrong.之後,如果我刷新頁面,則重定向正確完成。

任何線索是什麼問題?

編輯:

的錯誤僅僅是

enter image description here

+1

你可以發佈具體的錯誤? – lozadaOmr

+0

@lozadaOmr只是編輯了錯誤的圖像。 – Mario

+0

雖然只是看你的代碼,我似乎無法找到任何錯誤。我只是分享我如何做類似的基本'$ credentials = array('username'=> Input :: get('username'),'password'=> Input :: get('password'));'Then做'Auth :: attempt($ credentials);' 老實說,不知道這是否會有所作用 – lozadaOmr

回答

3

如果使用Laravel版本> 4.1.25,你可能會丟失對用戶表remember_token領域。

看到:http://laravel.com/docs/upgrade#upgrade-4.1.26

Laravel需要 「VARCHAR的可空remember_token(100),文本,或等同於你的用戶表。」

+0

非常感謝!你拯救了我的一天。 – Mario