refactoring. adding back pagination.
This commit is contained in:
@@ -46,6 +46,14 @@ class Payload {
|
||||
*
|
||||
* A default value may also be specified, and will be returned in the item doesn't exist.
|
||||
*
|
||||
* <code>
|
||||
* // Get an item from the session
|
||||
* $name = Session::get('name');
|
||||
*
|
||||
* // Return a default value if the item doesn't exist
|
||||
* $name = Session::get('name', 'Taylor');
|
||||
* </code>
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
@@ -66,6 +74,11 @@ class Payload {
|
||||
/**
|
||||
* Write an item to the session.
|
||||
*
|
||||
* <code>
|
||||
* // Write an item to the session
|
||||
* Session::put('name', 'Taylor');
|
||||
* </code>
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return Driver
|
||||
@@ -83,6 +96,11 @@ class Payload {
|
||||
* Flash data only exists for the next request. After that, it will be removed from
|
||||
* the session. Flash data is useful for temporary status or welcome messages.
|
||||
*
|
||||
* <code>
|
||||
* // Flash an item to the session
|
||||
* Session::flash('name', 'Taylor');
|
||||
* </code>
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return Driver
|
||||
@@ -110,6 +128,11 @@ class Payload {
|
||||
* If a string is passed to the method, only that item will be kept. An array may also
|
||||
* be passed to the method, in which case all items in the array will be kept.
|
||||
*
|
||||
* <code>
|
||||
* // Keep a session flash item from expiring
|
||||
* Session::keep('name');
|
||||
* </code>
|
||||
*
|
||||
* @param string|array $key
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,13 @@ class Cookie implements Transporter {
|
||||
*/
|
||||
protected $cookies;
|
||||
|
||||
/**
|
||||
* The name of the cookie used to store the session ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const key = 'laravel_session';
|
||||
|
||||
/**
|
||||
* Create a new cookie session transporter instance.
|
||||
*
|
||||
@@ -28,7 +35,7 @@ class Cookie implements Transporter {
|
||||
*/
|
||||
public function get($config)
|
||||
{
|
||||
return $this->cookies->get('laravel_session');
|
||||
return $this->cookies->get(Cookie::key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,9 +47,12 @@ class Cookie implements Transporter {
|
||||
*/
|
||||
public function put($id, $config)
|
||||
{
|
||||
$minutes = ($config['expire_on_close']) ? 0 : $config['lifetime'];
|
||||
// Session cookies may be set to expire on close, which means we will need to
|
||||
// pass "0" into the cookie manager. This will cause the cookie to not be
|
||||
// deleted until the user closes their browser.
|
||||
$minutes = ( ! $config['expire_on_close']) ? $config['lifetime'] : 0;
|
||||
|
||||
$this->cookies->put('laravel_session', $id, $minutes, $config['path'], $config['domain']);
|
||||
$this->cookies->put(Cookie::key, $id, $minutes, $config['path'], $config['domain']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php namespace Laravel\Session\Transporters;
|
||||
|
||||
/**
|
||||
* Session transporters are responsible for getting the session identifier
|
||||
* to the client. This can be done via cookies or some other means.
|
||||
*/
|
||||
interface Transporter {
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user