Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
ff5b6315
Commit
ff5b6315
authored
Dec 11, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added array access to session::Get
parent
a6c0407e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
changelog.md
changelog.md
+1
-0
payload.php
laravel/session/payload.php
+12
-6
No files found.
changelog.md
View file @
ff5b6315
...
...
@@ -2,6 +2,7 @@
## Version 2.0.5
-
Feature: Added array access to session::get.
-
Fix: Remove orderings before running pagination queries.
-
Fix: Session flush now correctly prepares empty data.
-
Fix: DB::raw now works on Eloquent properties.
...
...
laravel/session/payload.php
View file @
ff5b6315
...
...
@@ -142,17 +142,23 @@ class Payload {
*/
public
function
get
(
$key
,
$default
=
null
)
{
if
(
isset
(
$this
->
session
[
'data'
][
$key
]))
$session
=
$this
->
session
[
'data'
];
// We check for the item in the general session data first, and if it
// does not exist in that data, we will attempt to find it in the new
// and old flash data. If none of those arrays contain the requested
// item, we will just return the default value.
if
(
!
is_null
(
$value
=
Arr
::
get
(
$session
,
$key
)))
{
return
$
this
->
session
[
'data'
][
$key
]
;
return
$
value
;
}
elseif
(
isset
(
$this
->
session
[
'data'
][
':new:'
][
$key
]
))
elseif
(
!
is_null
(
$value
=
Arr
::
get
(
$session
[
':new:'
],
$key
)
))
{
return
$
this
->
session
[
'data'
][
':new:'
][
$key
]
;
return
$
value
;
}
elseif
(
isset
(
$this
->
session
[
'data'
][
':old:'
][
$key
]
))
elseif
(
!
is_null
(
$value
=
Arr
::
get
(
$session
[
':old:'
],
$key
)
))
{
return
$
this
->
session
[
'data'
][
':old:'
][
$key
]
;
return
$
value
;
}
return
(
$default
instanceof
Closure
)
?
call_user_func
(
$default
)
:
$default
;
...
...
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