Cookie.php 834 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Illuminate\Support\Facades;
  3. /**
  4. * @see \Illuminate\Cookie\CookieJar
  5. */
  6. class Cookie extends Facade
  7. {
  8. /**
  9. * Determine if a cookie exists on the request.
  10. *
  11. * @param string $key
  12. * @return bool
  13. */
  14. public static function has($key)
  15. {
  16. return ! is_null(static::$app['request']->cookie($key, null));
  17. }
  18. /**
  19. * Retrieve a cookie from the request.
  20. *
  21. * @param string $key
  22. * @param mixed $default
  23. * @return string
  24. */
  25. public static function get($key = null, $default = null)
  26. {
  27. return static::$app['request']->cookie($key, $default);
  28. }
  29. /**
  30. * Get the registered name of the component.
  31. *
  32. * @return string
  33. */
  34. protected static function getFacadeAccessor()
  35. {
  36. return 'cookie';
  37. }
  38. }