Skip to content

Commit

Permalink
Document Session::invalidate() (#6744)
Browse files Browse the repository at this point in the history
* Document `Session::invalidate()`

* Update session.md

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
u01jmg3 and taylorotwell authored Jan 14, 2021
1 parent 41d16c4 commit 9a08e72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion session.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,14 @@ The `forget` method will remove a piece of data from the session. If you would l

Regenerating the session ID is often done in order to prevent malicious users from exploiting a [session fixation](https://owasp.org/www-community/attacks/Session_fixation) attack on your application.

Laravel automatically regenerates the session ID during authentication if you are using one of the Laravel [application starter kits](/docs/{{version}}/starter-kits) or [Laravel Fortify](/docs/{{version}}/fortify); however, if you need to manually regenerate the session ID, you may use the `regenerate` method.
Laravel automatically regenerates the session ID during authentication if you are using one of the Laravel [application starter kits](/docs/{{version}}/starter-kits) or [Laravel Fortify](/docs/{{version}}/fortify); however, if you need to manually regenerate the session ID, you may use the `regenerate` method:

$request->session()->regenerate();

If you need to regenerate the session ID and remove all data from the session in a single statement, you may use the `invalidate` method:

$request->session()->invalidate();

<a name="session-blocking"></a>
## Session Blocking

Expand Down

0 comments on commit 9a08e72

Please sign in to comment.