当前位置: 首页>>代码示例>>PHP>>正文


PHP SessionManager::set方法代码示例

本文整理汇总了PHP中Illuminate\Session\SessionManager::set方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::set方法的具体用法?PHP SessionManager::set怎么用?PHP SessionManager::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Session\SessionManager的用法示例。


在下文中一共展示了SessionManager::set方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 /**
  * Add a product to the cart, if the product id already exists then increment its quantity
  * @param integer  $id
  * @param string  $name
  * @param integer  $price
  * @param integer $quantity
  * @param array   $options
  * @return array
  */
 public function add($id, $name = '', $price = 0, $quantity = 1, array $options = [])
 {
     $cartItems = $this->getCartSession();
     foreach ($cartItems as &$cartItem) {
         if ($cartItem['id'] == $id) {
             $cartItem['quantity'] = $cartItem['quantity'] + $quantity;
             $this->session->set(config('sescart.session_name'), $cartItems);
             return $cartItem;
         }
     }
     $newItem = ['id' => $id, 'name' => $name, 'price' => $price, 'quantity' => $quantity, 'options' => $options];
     $this->session->push(config('sescart.session_name'), $newItem);
     return $newItem;
 }
开发者ID:abstracteverything,项目名称:sescart,代码行数:23,代码来源:CartManager.php

示例2: setLocation

 /**
  * Sets the location property to the drivers returned location object.
  *
  * @param string $ip
  */
 private function setLocation($ip = '')
 {
     // The location session key.
     $key = 'location';
     // Removes location from the session if config option is set
     if ($this->localHostForgetLocation()) {
         $this->session->forget($key);
     }
     // Check if the location has already been set in the current session
     if ($this->session->has($key)) {
         // Set the current driver to the current session location
         $this->location = $this->session->get($key);
     } else {
         $this->setIp($ip);
         $this->location = $this->driver->get($this->ip);
         // The locations object property 'error' will be true if an
         // exception has occurred trying to grab the location
         // from the driver. Let's try retrieving the
         // location from one of our fall-backs
         if ($this->location->error) {
             $this->location = $this->getLocationFromFallback();
         }
         $this->session->set($key, $this->location);
     }
 }
开发者ID:muhamadsyahril,项目名称:location,代码行数:30,代码来源:Location.php

示例3: doAuthenticate

 /**
  * @author LAHAXE Arnaud
  *
  * @param \App\User $user
  * @param           $authData
  * @param           $keyData
  *
  * @return bool
  */
 public function doAuthenticate(User $user, $authData, $keyData)
 {
     $reg = $this->u2f->doAuthenticate($authData, U2fKey::where('user_id', $user->id)->get()->all(), $keyData);
     $U2fKey = U2fKey::where(['user_id' => $user->id, 'publicKey' => $reg->publicKey])->first();
     if (is_null($U2fKey)) {
         return false;
     }
     $U2fKey->counter = $reg->counter;
     $U2fKey->save();
     $this->session->set($this->config->get('u2f.sessionU2fName'), true);
     return $U2fKey;
 }
开发者ID:certly,项目名称:laravel-u2f,代码行数:21,代码来源:U2f.php

示例4: setLocation

 /**
  * Sets the location property to the drivers returned location object.
  *
  * @param string $ip
  */
 private function setLocation($ip = '')
 {
     /*
      * Removes location from the session if config option is set
      */
     if ($this->localHostForgetLocation()) {
         $this->session->forget('location');
     }
     /*
      * Check if the location has already been set in the current session
      */
     if ($this->session->has('location')) {
         /*
          * Set the current driver to the current session location
          */
         $this->location = $this->session->get('location');
     } else {
         /*
          * Set the IP
          */
         $this->setIp($ip);
         /*
          * Set the location
          */
         $this->location = $this->driver->get($this->ip);
         /*
          * The locations object property 'error' will be true if an exception has
          * occurred trying to grab the location from the driver. Let's
          * try retrieving the location from one of our fall-backs
          */
         if ($this->location->error) {
             $this->location = $this->getLocationFromFallback();
         }
         $this->session->set('location', $this->location);
     }
 }
开发者ID:ktardthong,项目名称:beerhit,代码行数:41,代码来源:Location.php

示例5: setAuthData

 /**
  * Recent / Providers
  * @param $provider
  * @param $data
  */
 public function setAuthData($provider, $data)
 {
     $this->session->set('__sp_auth.r', $provider);
     $this->session->set('__sp_auth.p.' . $provider, array_merge(['provider' => $provider], $data));
     $this->session->save();
 }
开发者ID:morrelinko,项目名称:laravel5-socialplus,代码行数:11,代码来源:SocialPlus.php

示例6: removeSectionData

 public function removeSectionData($section)
 {
     $this->sessionManager->set($section, null);
 }
开发者ID:mesour,项目名称:laravel-bridges,代码行数:4,代码来源:Session.php


注:本文中的Illuminate\Session\SessionManager::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。