本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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();
}
示例6: removeSectionData
public function removeSectionData($section)
{
$this->sessionManager->set($section, null);
}