You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This static method retrieves the values stored in `$_SESSION`. It can return the value of a specific session or all values of `$_SESSION` if no name is provided. If the session name does not exist and no value is specified for `$default`, this method throws an exception of type `RuntimeException`; otherwise, it will return the default value.
37
+
This static method retrieves the values stored in $_SESSION that match the name passed. It may return the value of the superglobal $_SESSION if a value for name is not provided. If the session name does not exist, this method returns the value of $default.
33
38
34
39
**Parameters:**
35
40
-`$name` (string|null): The name of the session variable to retrieve. Default is `null`.
This method sets a flash message in the session cookie, the data stored in the session using this method will be available immediately and during the subsequent HTTP request. After the subsequent HTTP request, the detailed data will be deleted.
106
+
107
+
**Parameters:**
108
+
-`$name` (string): The name of the message identifier to set.
109
+
-`$value` (mixed): The value to assign to the flash message. Default is `null`.
110
+
111
+
### Set a session message
112
+
To store a flash message just call the `Session::flash()` method and pass the name and the message.
113
+
114
+
```php
115
+
Session::flash('message','Hello Word!!');
116
+
```
117
+
118
+
### Return a session message
119
+
To return the message just call the `Session::flash()` method but this time just provide the name.
120
+
121
+
> [!NOTE]
122
+
> Remember that `Session::flash()` will only return the flash message once after that it is deleted.
0 commit comments