Skip to content
Advertisement

How to get id logout usde

I’m using laravel 5.8 my question is how to get logout user id because I print logout user data on home page.

 public function userLogin()
    {
   
        return view('frontend.user-login');
    }

Advertisement

Answer

Try this, here user contains the data from your user table :

public function userLogin()
{
  $user = Auth::user();
  // logout here
  // Auth::logout();
  // Session::flush();
  return view('frontend.user-login', compact('user'));
}

In your blade you can get the data like this :

@if(!empty($user)) {{ $user->id }} @endif
@if(!empty($user)) {{ $user->email }} @endif
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement