Cookie.php 958B

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