當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。