コード例 #1
0
 /**
  * Add the session cookie to the application response.
  *
  * @param  \Symfony\Component\HttpFoundation\Response  $response
  * @param  \Illuminate\Session\SessionInterface  $session
  * @return void
  */
 protected function addCookieToResponse(Response $response, SessionInterface $session)
 {
     if ($this->usingCookieSessions()) {
         $this->manager->driver()->save();
     }
     if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) {
         $response->headers->setCookie(new Cookie($session->getName(), $session->getId(), $this->getCookieExpirationDate(), $config['path'], $config['domain'], array_get($config, 'secure', false)));
     }
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function addIdentifierToResponse(Response $response, SessionInterface $session)
 {
     if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) {
         $response->headers->set("X-Session-Token", $session->getId());
     }
 }