We're currently developing with Laravel but we are having issues when a user was logged out because of session timeout. What we did for debugging was:
- Set the session timeout to one minute.
- Simply login. (everything was fine)
- Waited for a minute before the session expires.
- After the session expires, the system logged out.
- Upon logging in again, the session wasn't set and returns no value.
Here's how we add the session at LoginController.php
:
$hotelier = Hotelier::where('user_id',auth()->user()->id)->first();
$company = Company::find($hotelier->company_id);
Session::put('company_id', $hotelier->company_id);
Session::put('company_api_key', $company->api_key);
Here's our code upon logout at AuthenticateUsers.php
public function logout(Request $request) {
$this->guard()->logout();
$request->session()->invalidate();
return redirect('/');
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire