/**
  * 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);
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }
Ejemplo n.º 3
0
 /**
  * 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);
 }
Ejemplo n.º 4
0
 /**
  * {@inheritDoc}
  */
 public function put($value)
 {
     $cookie = $this->jar->forever($this->key, $value);
     $this->jar->queue($cookie);
 }
Ejemplo n.º 5
0
 /**
  * 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);
 }
Ejemplo n.º 6
0
	/**
	 * 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);
	}