| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Illuminate\Support\Facades;
|
|
|
4 |
|
|
|
5 |
/**
|
|
|
6 |
* @method static \Symfony\Component\HttpFoundation\Cookie make(string $name, string $value, int $minutes = 0, string|null $path = null, string|null $domain = null, bool|null $secure = null, bool $httpOnly = true, bool $raw = false, string|null $sameSite = null)
|
|
|
7 |
* @method static \Symfony\Component\HttpFoundation\Cookie forever(string $name, string $value, string|null $path = null, string|null $domain = null, bool|null $secure = null, bool $httpOnly = true, bool $raw = false, string|null $sameSite = null)
|
|
|
8 |
* @method static \Symfony\Component\HttpFoundation\Cookie forget(string $name, string|null $path = null, string|null $domain = null)
|
|
|
9 |
* @method static bool hasQueued(string $key, string|null $path = null)
|
|
|
10 |
* @method static \Symfony\Component\HttpFoundation\Cookie|null queued(string $key, mixed $default = null, string|null $path = null)
|
|
|
11 |
* @method static void queue(array ...$parameters)
|
|
|
12 |
* @method static void expire(string $name, string|null $path = null, string|null $domain = null)
|
|
|
13 |
* @method static void unqueue(string $name, string|null $path = null)
|
|
|
14 |
* @method static \Illuminate\Cookie\CookieJar setDefaultPathAndDomain(string $path, string $domain, bool $secure = false, string|null $sameSite = null)
|
|
|
15 |
* @method static \Symfony\Component\HttpFoundation\Cookie[] getQueuedCookies()
|
|
|
16 |
* @method static \Illuminate\Cookie\CookieJar flushQueuedCookies()
|
|
|
17 |
* @method static void macro(string $name, object|callable $macro)
|
|
|
18 |
* @method static void mixin(object $mixin, bool $replace = true)
|
|
|
19 |
* @method static bool hasMacro(string $name)
|
|
|
20 |
* @method static void flushMacros()
|
|
|
21 |
*
|
|
|
22 |
* @see \Illuminate\Cookie\CookieJar
|
|
|
23 |
*/
|
|
|
24 |
class Cookie extends Facade
|
|
|
25 |
{
|
|
|
26 |
/**
|
|
|
27 |
* Determine if a cookie exists on the request.
|
|
|
28 |
*
|
|
|
29 |
* @param string $key
|
|
|
30 |
* @return bool
|
|
|
31 |
*/
|
|
|
32 |
public static function has($key)
|
|
|
33 |
{
|
|
|
34 |
return ! is_null(static::$app['request']->cookie($key, null));
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
/**
|
|
|
38 |
* Retrieve a cookie from the request.
|
|
|
39 |
*
|
|
|
40 |
* @param string|null $key
|
|
|
41 |
* @param mixed $default
|
|
|
42 |
* @return string|array|null
|
|
|
43 |
*/
|
|
|
44 |
public static function get($key = null, $default = null)
|
|
|
45 |
{
|
|
|
46 |
return static::$app['request']->cookie($key, $default);
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
/**
|
|
|
50 |
* Get the registered name of the component.
|
|
|
51 |
*
|
|
|
52 |
* @return string
|
|
|
53 |
*/
|
|
|
54 |
protected static function getFacadeAccessor()
|
|
|
55 |
{
|
|
|
56 |
return 'cookie';
|
|
|
57 |
}
|
|
|
58 |
}
|