Created
March 2, 2018 13:43
-
-
Save ldelcampof/c353e2da1745c5af472573f4df862173 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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