My Laravel 5.4 Logged in User Sessions wont persist

Viewed 295

I'm having this weird issue with my app, it can't persist logged in user session using the Auth facade. Example, in my header view I put logged in user data as :

@if (Auth::check())
    <div class="btn-group">
       <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
       <img src="{{route('getphoto', Auth::user()->image)}}" alt="" />
       {{ Auth::user()->name }}
       <span class="caret"></span>
       </button>
     </div>
@else
     <div class="btn-group">
       <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
       Not Logged In
       </button>
     </div>
@endif

At the first time after login the logged in user data in the header like photo and name will be displayed correctly, but after I refresh or moving to another page they disappear and indicate that the user is not logged in. I don't know what I did wrong, all I did with user login related function is just changing the email to username. How do I solve this ? I'm using Laravel 5.4

1 Answers
Related