2011-09-15 20:23:30 -05:00
|
|
|
<?php namespace Laravel\Session\Transporters;
|
|
|
|
|
|
2011-09-20 23:14:09 -05:00
|
|
|
class Cookie implements Transporter {
|
2011-09-15 20:23:30 -05:00
|
|
|
|
2011-10-04 21:43:39 -05:00
|
|
|
/**
|
|
|
|
|
* The name of the cookie used to store the session ID.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
const key = 'laravel_session';
|
|
|
|
|
|
2011-09-15 20:23:30 -05:00
|
|
|
/**
|
|
|
|
|
* Get the session identifier for the request.
|
|
|
|
|
*
|
2011-09-15 22:21:29 -05:00
|
|
|
* @param array $config
|
2011-09-15 20:23:30 -05:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2011-09-15 22:21:29 -05:00
|
|
|
public function get($config)
|
2011-09-15 20:23:30 -05:00
|
|
|
{
|
2011-10-05 18:32:48 -05:00
|
|
|
return \Laravel\Cookie::get(Cookie::key);
|
2011-09-15 20:23:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Store the session identifier for the request.
|
|
|
|
|
*
|
|
|
|
|
* @param string $id
|
|
|
|
|
* @param array $config
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function put($id, $config)
|
|
|
|
|
{
|
2011-10-15 14:39:52 -05:00
|
|
|
extract($config, EXTR_SKIP);
|
2011-09-15 20:23:30 -05:00
|
|
|
|
2011-10-15 14:39:52 -05:00
|
|
|
$minutes = ( ! $expire_on_close) ? $lifetime : 0;
|
|
|
|
|
|
|
|
|
|
\Laravel\Cookie::put(Cookie::key, $id, $minutes, $path, $domain, $secure);
|
2011-09-15 20:23:30 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|