當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CookieJar::forever方法代碼示例

本文整理匯總了PHP中Illuminate\Cookie\CookieJar::forever方法的典型用法代碼示例。如果您正苦於以下問題:PHP CookieJar::forever方法的具體用法?PHP CookieJar::forever怎麽用?PHP CookieJar::forever使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Cookie\CookieJar的用法示例。


在下文中一共展示了CookieJar::forever方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (php_sapi_name() == 'cli' || !INSTALLED) {
         return $next($request);
     }
     $lastUpdate = $request->cookie('last_visit');
     if (!$lastUpdate || $lastUpdate->day != Carbon::now()->day) {
         $this->stat->increment('visits');
         $cookie = $this->cookieJar->forever('last_visit', Carbon::now());
         $this->cookieJar->queue($cookie);
     }
     return $next($request);
 }
開發者ID:vjaykoogu,項目名稱:smile-media-laravel,代碼行數:20,代碼來源:RequestTracker.php

示例2: setCookie

 /**
  * 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);
 }
開發者ID:fastwebmedia,項目名稱:laravel-avp,代碼行數:22,代碼來源:Validation.php

示例3: forever

 /**
  * Create a cookie that lasts "forever" (five years).
  *
  * @param string $name
  * @param string $value
  * @param string $path
  * @param string $domain
  * @param bool $secure
  * @param bool $httpOnly
  * @return \Symfony\Component\HttpFoundation\Cookie 
  * @static 
  */
 public static function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true)
 {
     return \Illuminate\Cookie\CookieJar::forever($name, $value, $path, $domain, $secure, $httpOnly);
 }
開發者ID:satriashp,項目名稱:tour,代碼行數:16,代碼來源:_ide_helper.php

示例4: put

 /**
  * {@inheritDoc}
  */
 public function put($value)
 {
     $cookie = $this->jar->forever($this->key, $value);
     $this->jar->queue($cookie);
 }
開發者ID:kevin416,項目名稱:admin,代碼行數:8,代碼來源:IlluminateCookie.php

示例5: forever

 /**
  * Put a value in the Sentry cookie forever.
  *
  * @param  mixed  $value
  * @return void
  */
 public function forever($value)
 {
     $cookie = $this->jar->forever($this->getKey(), $value);
     $this->jar->queue($cookie);
 }
開發者ID:peintune,項目名稱:Ternado,代碼行數:11,代碼來源:IlluminateCookie.php

示例6: forever

	/**
	 * Put a value in the Sentry cookie forever.
	 *
	 * @param  mixed  $value
	 * @return void
	 */
	public function forever($value)
	{
		$this->cookie = $this->jar->forever($this->getKey(), $value);
	}
開發者ID:pcerbino,項目名稱:falcionevega,代碼行數:10,代碼來源:IlluminateCookie.php


注:本文中的Illuminate\Cookie\CookieJar::forever方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。