dimanche 21 octobre 2018

how to manage session different according to user in laravel 5.6?

I have used session to save the user_type, email and user_id of logged in user.

 $user_type = $data['user_type'];
 $user_id = $data['user_id'];
 $uemail = $data['uemail'];

  Session::put('userSession',$uemail);
  Session::put('loginSession',$user_type);
  Session::put('idSession',$user_id);

I want to show the currently logged in user email in header.

  <?php $id = Session::get('userSession'); ?>
  <li class="dropdown" id="profile-messages" ><a title="Login Name" data-toggle="dropdown" data-target="#profile-messages" class="dropdown-toggle"><i class="icon icon-user"></i>  <span class="text"><?php echo $id; ?></span><b class="caret"></b> </a>
  <ul class="dropdown-menu">
    <li><a title="Settings" href=""><i class="icon icon-cog"></i> Settings</a></li>
    <li class="divider"></li>
    <li><a title="Log Out" href=""><i class="icon-key"></i> Log Out</a></li>
  </ul>
</li>

But the problem is when three users are logged in same time, then it shows the same email in the header and also Id and user_type also becomes same. I want to have session of particular user differently.

so, how to solve this problem?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire