cookie.php 734 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php namespace Laravel\Session\Transporters;
  2. class Cookie implements Transporter {
  3. /**
  4. * The name of the cookie used to store the session ID.
  5. *
  6. * @var string
  7. */
  8. const key = 'laravel_session';
  9. /**
  10. * Get the session identifier for the request.
  11. *
  12. * @param array $config
  13. * @return string
  14. */
  15. public function get($config)
  16. {
  17. return \Laravel\Cookie::get(Cookie::key);
  18. }
  19. /**
  20. * Store the session identifier for the request.
  21. *
  22. * @param string $id
  23. * @param array $config
  24. * @return void
  25. */
  26. public function put($id, $config)
  27. {
  28. extract($config, EXTR_SKIP);
  29. $minutes = ( ! $expire_on_close) ? $lifetime : 0;
  30. \Laravel\Cookie::put(Cookie::key, $id, $minutes, $path, $domain, $secure);
  31. }
  32. }