本文整理汇总了PHP中Illuminate\Session\SessionManager::put方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::put方法的具体用法?PHP SessionManager::put怎么用?PHP SessionManager::put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Session\SessionManager
的用法示例。
在下文中一共展示了SessionManager::put方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPersistentData
/**
* {@inheritdoc}
*
* @see BaseFacebook::setPersistentData()
*/
protected function setPersistentData($key, $value)
{
if (!in_array($key, self::$kSupportedKeys)) {
self::errorLog('Unsupported key passed to setPersistentData.');
return;
}
$session_var_name = $this->constructSessionVariableName($key);
$this->laravelSession->put($session_var_name, $value);
}
示例2: setAppLocale
/**
* Sets the app locale
*
* @param string $locale
* @param bool $session
* @return void
*/
public function setAppLocale($locale = null, $session = true)
{
$locale = $locale ?: $this->session->get('_locale', null);
if ($locale) {
$this->app->setLocale($locale);
if ($session) {
$this->session->put('_locale', $locale);
}
$this->setTimeLocale($locale);
}
}
示例3: switchLocale
/**
* POST method for switching a user's locale
*
* @param string $locale
*
* @return JSON
*/
public function switchLocale($locale)
{
if (in_array($locale, config('administrator.locales'))) {
$this->session->put('administrator_locale', $locale);
}
return redirect()->back();
}
示例4: settingsCustomAction
/**
* POST method for handling custom actions on the settings page.
*
* @param string $settingsName
*
* @return JSON
*/
public function settingsCustomAction($settingsName)
{
$config = app('itemconfig');
$actionFactory = app('admin_action_factory');
$actionName = $this->request->input('action_name', false);
//get the action and perform the custom action
$action = $actionFactory->getByName($actionName);
$data = $config->getDataModel();
$result = $action->perform($data);
//override the config options so that we can get the latest
app('admin_config_factory')->updateConfigOptions();
//if the result is a string, return that as an error.
if (is_string($result)) {
return response()->json(array('success' => false, 'error' => $result));
} elseif (!$result) {
$messages = $action->getOption('messages');
return response()->json(array('success' => false, 'error' => $messages['error']));
} else {
$response = array('success' => true, 'actions' => $actionFactory->getActionsOptions(true));
//if it's a download response, flash the response to the session and return the download link
if (is_a($result, 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse')) {
$file = $result->getFile()->getRealPath();
$headers = $result->headers->all();
$this->session->put('administrator_download_response', array('file' => $file, 'headers' => $headers));
$response['download'] = route('admin_file_download');
} elseif (is_a($result, '\\Illuminate\\Http\\RedirectResponse')) {
$response['redirect'] = $result->getTargetUrl();
}
return response()->json($response);
}
}
示例5: create
/**
* Create captcha image
* @param null $formId
*/
public function create($formId = null)
{
//Generate formId
if (empty($formId)) {
//$formId = $this->fromPreviousUrl();
$formId = $this->fromAppKey();
}
//Generate random string
$string = $this->randomString($this->config->get('captcha.length'), $this->config->get('captcha.letters') && $this->config->get('captcha.numbers') ? 1 : ($this->config->get('captcha.letters') ? 2 : 3), $this->config->get('captcha.case') == 'upper' ? 2 : ($this->config->get('captcha.case') == 'lower' ? 3 : 1));
//Store in session
$this->session->put("{$this->storeKey}.{$formId}", $this->hash($this->config->get('captcha.case_sensitive') ? $string : strtolower($string)));
//Colors
$colors = $this->config->get('captcha.colors');
$background = $this->config->get('captcha.background');
$line = $this->config->get('captcha.line_color');
//Create image
$image = imagecreatetruecolor($this->config->get('captcha.width'), $this->config->get('captcha.height'));
//Colors
$background = imagecolorallocate($image, $background[0], $background[1], $background[2]);
$line = imagecolorallocate($image, $line[0], $line[1], $line[2]);
//Background
imagefilledrectangle($image, 0, 0, $this->config->get('captcha.width'), $this->config->get('captcha.height'), $background);
//Background Horizontal lines
for ($i = 1; $i < $this->config->get('captcha.h_lines'); $i++) {
imageline($image, 0, $this->config->get('captcha.height') / $this->config->get('captcha.h_lines') * $i, $this->config->get('captcha.width'), $this->config->get('captcha.height') / $this->config->get('captcha.h_lines') * $i, $line);
}
//Background Vertical lines
for ($i = 1; $i < $this->config->get('captcha.v_lines'); $i++) {
imageline($image, $this->config->get('captcha.width') / $this->config->get('captcha.v_lines') * $i, 0, $this->config->get('captcha.width') / $this->config->get('captcha.v_lines') * $i, $this->config->get('captcha.height'), $line);
}
//Text
for ($i = 0; $i < $this->config->get('captcha.length'); $i++) {
$color = $colors[rand(0, count($colors) - 1)];
imagettftext($image, $this->config->get('captcha.size'), rand(-$this->config->get('captcha.angle'), $this->config->get('captcha.angle')), 10 + $i * $this->config->get('captcha.separation'), $this->config->get('captcha.size') + 10, imagecolorallocate($image, $color[0], $color[1], $color[2]), $this->font, substr($string, $i, 1));
}
//Stream
header('Content-Type: image/jpeg');
header('Cache-Control: no-cache, no-store, must-revalidate');
imagejpeg($image, null, $this->config->get('captcha.quality'));
imagedestroy($image);
}
示例6: getAuthLink
public function getAuthLink(SessionManager $session, Manager $auth, $provider)
{
$user = Socialite::driver($provider)->user();
$dbUser = $auth->user();
$link = SocialConnection::ofCredentials($provider, $user->id)->first();
$linked = !is_null($link);
$authenticated = !is_null($dbUser);
// Link: Authenticated not linked
if ($authenticated && !$linked) {
// Link
$dbUser->attachProvider($provider, $user);
return redirect('/')->with('success', 'Account connected to "' . $provider . '" successfully.');
} elseif (!$authenticated && $linked) {
// Log in user
$dbUser = $auth->login($link->user_id);
return redirect('/')->with('success', 'Authentication with "' . $provider . '" was successful');
} else {
// Store to connect accounts after login
$session->put('social_link', ['user' => $user, 'provider' => $provider]);
// No user found - redirect to login
return redirect('login')->with('error', 'No matching records found, please login to link accounts.');
}
}
示例7: save
/**
* Sync the cart to session.
*
* @param \Illuminate\Support\Collection|null $cart The new cart content
*
* @return \Illuminate\Support\Collection
*/
protected function save($cart)
{
$this->session->put($this->name, $cart);
return $cart;
}
示例8: create
/**
* 인증 세션 생성
*
* @param ItemEntity $item board item entity
* @return void
*/
public function create(ItemEntity $item)
{
$this->session->put($this->getKey($item->id), ['certifyKey' => $item->certifyKey, 'expire' => $this->expireTime()]);
}
示例9: updateCart
/**
* Update the cart
*
* @param \Illuminate\Support\Collection|null $cart The new cart content
* @return \Illuminate\Support\Collection
*/
protected function updateCart($cart)
{
return $this->session->put($this->getInstance(), $cart);
}
示例10: set
/**
* Sets a key-value pair in storage.
*
* @param string $key The key to set
* @param mixed $value The value to set
*
* @return null
*/
public function set($key, $value)
{
$this->session->put($this->storageKey . '.' . $key, $value);
return null;
}
示例11: saveMessage
protected function saveMessage($message)
{
$this->session->put('message', $message);
// $this->message = $message;
}
示例12: storeAccessToken
/**
* {@inheritDoc}
*/
public function storeAccessToken($service, TokenInterface $token)
{
$name = $this->storageName($service);
$this->session->put($name, serialize($token));
return $this;
}
示例13: create
/**
* 인증 세션 생성
*
* @param Board $board board model
* @return void
*/
public function create(Board $board)
{
$this->session->put($this->getKey($board->id), ['certifyKey' => $board->certifyKey, 'expire' => $this->expireTime()]);
}