Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
f68a918d
Commit
f68a918d
authored
Oct 12, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring session classes.
parent
4342f82a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
laravel/session/payload.php
+11
-10
laravel/session/transporters/cookie.php
+3
-3
No files found.
laravel/session/payload.php
View file @
f68a918d
...
@@ -41,8 +41,6 @@ class Payload {
...
@@ -41,8 +41,6 @@ class Payload {
/**
/**
* Get an item from the session.
* Get an item from the session.
*
*
* A default value may also be specified, and will be returned in the item doesn't exist.
*
* <code>
* <code>
* // Get an item from the session
* // Get an item from the session
* $name = Session::get('name');
* $name = Session::get('name');
...
@@ -90,8 +88,9 @@ class Payload {
...
@@ -90,8 +88,9 @@ class Payload {
/**
/**
* Write an item to the session flash data.
* Write an item to the session flash data.
*
*
* Flash data only exists for the next request. After that, it will be removed from
* Flash data only exists for the next request. After that, it will
* the session. Flash data is useful for temporary status or welcome messages.
* be removed from the session. Flash data is useful for temporary
* status or welcome messages.
*
*
* <code>
* <code>
* // Flash an item to the session
* // Flash an item to the session
...
@@ -122,8 +121,9 @@ class Payload {
...
@@ -122,8 +121,9 @@ class Payload {
/**
/**
* Keep a session flash item from expiring at the end of the request.
* Keep a session flash item from expiring at the end of the request.
*
*
* If a string is passed to the method, only that item will be kept. An array may also
* If a string is passed to the method, only that item will be kept.
* be passed to the method, in which case all items in the array will be kept.
* An array may also be passed to the method, in which case all
* items in the array will be kept.
*
*
* <code>
* <code>
* // Keep a session flash item from expiring
* // Keep a session flash item from expiring
...
@@ -178,8 +178,8 @@ class Payload {
...
@@ -178,8 +178,8 @@ class Payload {
/**
/**
* Age the session payload, preparing it for storage after a request.
* Age the session payload, preparing it for storage after a request.
*
*
* The session flash data will be aged and the last activity timestamp will
be updated.
* The session flash data will be aged and the last activity timestamp will
* The aged session array will be returned by the method.
*
be updated.
The aged session array will be returned by the method.
*
*
* @return array
* @return array
*/
*/
...
@@ -187,8 +187,9 @@ class Payload {
...
@@ -187,8 +187,9 @@ class Payload {
{
{
$this
->
session
[
'last_activity'
]
=
time
();
$this
->
session
[
'last_activity'
]
=
time
();
// To age the data, we will forget all of the old keys and then rewrite the newly
// To age the data, we will forget all of the old keys and then
// flashed items to have old keys, which will be available for the next request.
// rewrite the newly flashed items to have old keys, which will
// be available for the next request.
foreach
(
$this
->
session
[
'data'
]
as
$key
=>
$value
)
foreach
(
$this
->
session
[
'data'
]
as
$key
=>
$value
)
{
{
if
(
strpos
(
$key
,
':old:'
)
===
0
)
$this
->
forget
(
$key
);
if
(
strpos
(
$key
,
':old:'
)
===
0
)
$this
->
forget
(
$key
);
...
...
laravel/session/transporters/cookie.php
View file @
f68a918d
...
@@ -29,9 +29,9 @@ class Cookie implements Transporter {
...
@@ -29,9 +29,9 @@ class Cookie implements Transporter {
*/
*/
public
function
put
(
$id
,
$config
)
public
function
put
(
$id
,
$config
)
{
{
// Session cookies may be set to expire on close, which means we
will need to
// Session cookies may be set to expire on close, which means we
//
pass "0" into the cookie manager. This will cause the cookie to not b
e
//
will need to pass "0" into the cookie manager. This will caus
e
// deleted until the user closes their browser.
//
the cookie to not be
deleted until the user closes their browser.
$minutes
=
(
!
$config
[
'expire_on_close'
])
?
$config
[
'lifetime'
]
:
0
;
$minutes
=
(
!
$config
[
'expire_on_close'
])
?
$config
[
'lifetime'
]
:
0
;
\Laravel\Cookie
::
put
(
Cookie
::
key
,
$id
,
$minutes
,
$config
[
'path'
],
$config
[
'domain'
],
$config
[
'secure'
]);
\Laravel\Cookie
::
put
(
Cookie
::
key
,
$id
,
$minutes
,
$config
[
'path'
],
$config
[
'domain'
],
$config
[
'secure'
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment