/** * Set the cookies * * @return $this */ protected function setCookie($remember_me = false) { if (config('laravel-avp.cookie_age') == 'forever') { // Set a forever cookie saying the user is old enough $cookie = $this->cookie->forever(config('laravel-avp.cookie_name'), config('laravel-avp.cookie_val')); } elseif ($remember_me) { // Remember for 30 days $cookie = $this->cookie->make(config('laravel-avp.cookie_name'), config('laravel-avp.cookie_val'), 60 * 24 * 30); } elseif (is_int(config('laravel-avp.cookie_age'))) { // Sets a cookie lasting X minutes saying the user is old enough $cookie = $this->cookie->make(config('laravel-avp.cookie_name'), config('laravel-avp.cookie_val'), config('laravel-avp.cookie_age')); } else { // Sets a session cookie saying the user is old enough $cookie = $this->cookie->make(config('laravel-avp.cookie_name'), config('laravel-avp.cookie_val')); } return redirect()->intended('/')->withCookie($cookie); }
/** * Create a new cookie instance. * * @param string $name * @param string $value * @param int $minutes * @param string $path * @param string $domain * @param bool $secure * @param bool $httpOnly * @return \Symfony\Component\HttpFoundation\Cookie * @static */ public static function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) { return \Illuminate\Cookie\CookieJar::make($name, $value, $minutes, $path, $domain, $secure, $httpOnly); }
/** * Put a value in the Sentry cookie. * * @param mixed $value * @param int $minutes * @return void */ public function put($value, $minutes) { $cookie = $this->jar->make($this->getKey(), $value, $minutes); $this->jar->queue($cookie); }
/** * Write the session cookie to the response. * * @param Illuminate\Cookie\CookieJar $cookie * @param string $name * @param int $lifetime * @return void */ public function getCookie(CookieJar $cookie, $name, $lifetime) { return $cookie->make($name, $this->getSessionId(), $lifetime); }
/** * {@inheritDoc} */ public function write($sessionId, $data) { $this->setCookie($this->cookie->make($sessionId, $data, $this->minutes)); }