After login by a user, the authentication should be rembered and Auth::check() should return true. But on the user profile it returns false. What's wrong or missing?
Route::post('login', function() {
$userdata = array(
'username' => Input::get('user'),
'password' => Input::get('pw')
);
if (Auth::attempt($userdata, true)) {
return Redirect::to('profile');
} else {
return Redirect::to('/')->with('login_errors', true);
}
});
Route::get('profile', function() {
return (Auth::check() ? 'logged in' : 'not logged in') . '<br />' .
(Auth::user()==null ? 'null' : Auth::user()->name);
});