I'm having an issue where Auth::attemp() is not persistently logging the user in.
My code that doesn't work:
if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')), Input::get('remember'))) {
print_r(Auth::user()); // prints user data
return Redirect::route('home');
// redirects back to login form because:
print_r(Auth::user()); // null
}
Hack that does work:
if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')), Input::get('remember'))) {
// manually log user in
Auth::login(Auth::user());
print_r(Auth::user()); // prints user data
// after redirect
print_r(Auth::user()); // still prints user data
}
I'm having an issue where Auth::attemp() is not persistently logging the user in.
My code that doesn't work:
Hack that does work: