@@ -177,7 +177,7 @@ protected function isExpired($session)
177177
178178 /**
179179 * Get the full array of session data, including flash data.
180- *
180+ *
181181 * @return array
182182 */
183183 public function all ()
@@ -210,28 +210,26 @@ public function get($key, $default = null)
210210 // First we will check for the value in the general session data and if it
211211 // is not present in that array we'll check the session flash datas to
212212 // get the data from there. If netiher is there we give the default.
213- if (isset ($ data [$ key ]))
214- {
215- return $ data [$ key ];
216- }
217-
218- // Session flash data is only persisted for the next request into the app
219- // which makes it convenient for temporary status messages or various
220- // other strings. We'll check all of this flash data for the items.
221- elseif (isset ($ data [':new: ' ][$ key ]))
213+ return array_get ($ data , $ key , function () use ($ data , $ key , $ default )
222214 {
223- return $ data [':new: ' ][$ key ];
224- }
225-
226- // The "old" flash data are the data flashed during the previous request
227- // while the "new" data is the data flashed during the course of this
228- // current request. Usually developers will be retrieving the olds.
229- elseif (isset ($ data [':old: ' ][$ key ]))
230- {
231- return $ data [':old: ' ][$ key ];
232- }
215+ // Session flash data is only persisted for the next request into the app
216+ // which makes it convenient for temporary status messages or various
217+ // other strings. We'll check all of this flash data for the items.
218+ if ($ value = array_get ($ data , ":new:. $ key " ))
219+ {
220+ return $ value ;
221+ }
222+
223+ // The "old" flash data are the data flashed during the previous request
224+ // while the "new" data is the data flashed during the course of this
225+ // current request. Usually developers will be retrieving the olds.
226+ if ($ value = array_get ($ data , ":old:. $ key " ))
227+ {
228+ return $ value ;
229+ }
233230
234- return $ default instanceof Closure ? $ default () : $ default ;
231+ return $ default instanceof Closure ? $ default () : $ default ;
232+ });
235233 }
236234
237235 /**
@@ -252,14 +250,8 @@ public function getOldInput($key = null, $default = null)
252250 {
253251 return $ input ;
254252 }
255- elseif (array_key_exists ($ key , $ input ))
256- {
257- return $ input [$ key ];
258- }
259- else
260- {
261- return $ default instanceof Closure ? $ default () : $ default ;
262- }
253+
254+ return array_get ($ input , $ key , $ default );
263255 }
264256
265257 /**
@@ -281,7 +273,7 @@ public function getToken()
281273 */
282274 public function put ($ key , $ value )
283275 {
284- $ this ->session ['data ' ][ $ key] = $ value ;
276+ array_set ( $ this ->session ['data ' ], $ key, $ value) ;
285277 }
286278
287279 /**
@@ -343,7 +335,7 @@ public function keep($keys)
343335 */
344336 public function forget ($ key )
345337 {
346- unset ($ this ->session ['data ' ][ $ key] );
338+ array_forget ($ this ->session ['data ' ], $ key );
347339 }
348340
349341 /**
@@ -636,4 +628,4 @@ public function offsetUnset($key)
636628 $ this ->forget ($ key );
637629 }
638630
639- }
631+ }
0 commit comments