Laravel theorytheory 0/50 · 0%
Fundamentals · medium

25. Sessions

Persisting state across requests.

Sessions store user data across requests, configured via config/session.php with drivers like file, database, cookie, or Redis. Data is accessed with session('key') or $request->session()->get('key'), and flash data persists only for the next request (useful for one-time success messages). CSRF tokens, generated per session, protect state-changing forms.

Check your understanding

  1. 1. Which helper stores a value for only the next request?

  2. 2. What protects forms from cross-site request forgery?