Example #1
0
 /**
  * Test the Cookie::get method.
  *
  * @group laravel
  */
 public function testGetMethodCanReturnValueOfCookies()
 {
     Cookie::$jar['foo'] = array('value' => Cookie::hash('bar') . '+bar');
     $this->assertEquals('bar', Cookie::get('foo'));
     Cookie::put('bar', 'baz');
     $this->assertEquals('baz', Cookie::get('bar'));
 }
Example #2
0
 /**
  * Send the session ID cookie to the browser.
  *
  * @param  array  $config
  * @return void
  */
 protected function cookie($config)
 {
     extract($config, EXTR_SKIP);
     $minutes = !$expire_on_close ? $lifetime : 0;
     Cookie::put($cookie, $this->session['id'], $minutes, $path, $domain, $secure);
 }
Example #3
0
 /**
  * Store an authentication cookie.
  *
  * @param  string  $name
  * @param  string  $value
  * @param  int     $minutes
  * @return void
  */
 protected function cookie($name, $value, $minutes)
 {
     // When setting the default implementation of an authentication
     // cookie we'll use the same settings as the session cookie.
     // This typically makes sense as they both are sensitive.
     $config = Config::get('session');
     extract($config);
     Cookie::put($name, $value, $minutes, $path, $domain, $secure);
 }
Example #4
0
 /**
  * Save a given session to storage.
  *
  * @param  array  $session
  * @param  array  $config
  * @param  bool   $exists
  * @return void
  */
 public function save($session, $config, $exists)
 {
     extract($config, EXTR_SKIP);
     $payload = Crypter::encrypt(serialize($session));
     $success = \Laravel\Cookie::put(Cookie::payload, $payload, $lifetime, $path, $domain);
 }
Example #5
0
 protected function cookie($name, $value, $minutes)
 {
     $config = Config::get('session');
     extract($config);
     Cookie::put($name, $value, $minutes, $path, $domain, $secure);
 }