Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ldelcampof/c353e2da1745c5af472573f4df862173 to your computer and use it in GitHub Desktop.
Save ldelcampof/c353e2da1745c5af472573f4df862173 to your computer and use it in GitHub Desktop.
// users alter table
Schema::table('users', function(Blueprint $table){
$table->string('session_id')->nullable();
}
// on Auth/LoginController.php
// add this function
public function authenticated(Request $request,User $user){
$previous_session = $user->session_id;
if ($previous_session) {
\Session::getHandler()->destroy($previous_session);
}
Auth::user()->session_id = \Session::getId();
Auth::user()->save();
return redirect()->intended($this->redirectPath());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment