123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php namespace System;
- class Cookie {
-
- public static function has($name)
- {
- return ! is_null(static::get($name));
- }
-
- public static function get($name, $default = null)
- {
- return Arr::get($_COOKIE, $name, $default);
- }
-
- public static function forever($name, $value, $path = '/', $domain = null, $secure = false, $http_only = false)
- {
- return static::put($name, $value, 2628000, $path, $domain, $secure, $http_only);
- }
-
- public static function put($name, $value, $minutes = 0, $path = '/', $domain = null, $secure = false, $http_only = false)
- {
- if ($minutes < 0) unset($_COOKIE[$name]);
- return setcookie($name, $value, ($minutes != 0) ? time() + ($minutes * 60) : 0, $path, $domain, $secure, $http_only);
- }
-
- public static function forget($name)
- {
- return static::put($name, null, -60);
- }
- }
|