From 374f72f5e51c13cf375d64d5ddd46c9dc37ad23d Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 18 Nov 2011 10:43:37 -0600 Subject: [PATCH] Provide immediate access to set cookies. --- laravel/cookie.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/laravel/cookie.php b/laravel/cookie.php index 783ee161..c92d6d43 100644 --- a/laravel/cookie.php +++ b/laravel/cookie.php @@ -88,7 +88,14 @@ public static function put($name, $value, $minutes = 0, $path = '/', $domain = n { if (headers_sent()) return false; - if ($minutes < 0) unset($_COOKIE[$name]); + if ($minutes < 0) + { + unset($_COOKIE[$name]); + } + else + { + $_COOKIE[$name] = $value; + } $time = ($minutes !== 0) ? time() + ($minutes * 60) : 0; @@ -128,4 +135,4 @@ public static function forget($name) return static::put($name, null, -2000); } -} +} \ No newline at end of file