Thursday, March 30, 2017

Laravel authentication session failed

I am using laravel 5.2.45 following is my code for user authentication but unable to authenticate. i.e failed to create session after redirect to home lose the session.

My Controller:

  $login = array(
    'username' => $input['username'],
    'password' => $input['password']
  );
  if (Auth::attempt($login)) {
    return Redirect::route('home')->with('flash_notice', 'You are Successfully logged in.');
  }

 in home:

 if(Auth::check()) {
  echo "Logged in";
 } else {
 echo "Not logged in";
 }



via Hanumant

Advertisement