1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! HTTP is stateless, so a session is how your application remembers a user from one request
//! to the next, such as who is signed in or which message to show after a redirect.
//!
//! A request's [`Session`] holds its data and flash data. [`csrf_token`] and [`csrf_field`] put the
//! session's CSRF token in forms, and the [`SessionStore`] trait adds drivers of your own. To
//! learn more, check out the
//! [session guide](https://github.com/laravel/rust-framework/blob/0.x/docs/session.md).
//!
//! The `web` middleware group starts a session for every request with [`StartSession`]. To use
//! the session, take a [`Session`] as a handler argument:
//!
//! ```no_run
//! use laravel::http::Redirect;
//! use laravel::session::Session;
//!
//! async fn store(session: Session) -> Redirect {
//! session.put("theme", "dark");
//! session.flash("status", "Saved!");
//!
//! Redirect::back()
//! }
//! ```
//!
//! The configured [driver](crate::config::session::Driver) decides where the data lives. It may
//! be the encrypted session cookie itself, files, a database table, Redis, memory, or a store
//! that an application or package registers.
//!
//! Each request reads the session when it starts, and [`StartSession`] saves
//! the whole session when the request finishes. When two requests for the
//! same session overlap, the one that finishes last overwrites the other's
//! changes, so keep data that concurrent requests change in a database.
pub
pub use *;
pub use ;
/// Define a migration's `migrate` function to create the `database` session driver's table.
///
/// Put the macro alone in a migration file, and it creates the `sessions` table. To change the
/// table, replace the macro with the migration the
/// [session guide](https://github.com/laravel/rust-framework/blob/0.x/docs/session.md#the-database-session-table) shows,
/// then edit it.
///
/// ```
/// // database/migrations/0001_01_01_000000_create_sessions_table.rs
/// laravel::session::table!();
/// ```
pub use session_table as table;