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


PHP SessionManager::put方法代码示例

本文整理汇总了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);
 }
开发者ID:pageboost,项目名称:facebook-laravel,代码行数:14,代码来源:LaravelFacebook.php

示例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);
     }
 }
开发者ID:NuclearCMS,项目名称:Hierarchy,代码行数:18,代码来源:LocaleManager.php

示例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();
 }
开发者ID:nanosolutions,项目名称:Laravel-Administrator,代码行数:14,代码来源:AdminController.php

示例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);
     }
 }
开发者ID:hifone,项目名称:dashboard,代码行数:38,代码来源:AdminController.php

示例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);
 }
开发者ID:thytanium,项目名称:captcha,代码行数:45,代码来源:Captcha.php

示例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.');
     }
 }
开发者ID:humweb,项目名称:sociable,代码行数:23,代码来源:AuthController.php

示例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;
 }
开发者ID:DekingChen,项目名称:laravel-shopping-cart,代码行数:12,代码来源:Cart.php

示例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()]);
 }
开发者ID:khongchi,项目名称:plugin-board,代码行数:10,代码来源:IdentifyManager.php

示例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);
 }
开发者ID:JackieDo,项目名称:LaravelShoppingCart,代码行数:10,代码来源:Cart.php

示例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;
 }
开发者ID:khangaikh,项目名称:golocal,代码行数:13,代码来源:ParseSessionStorage.php

示例11: saveMessage

 protected function saveMessage($message)
 {
     $this->session->put('message', $message);
     //     	$this->message = $message;
 }
开发者ID:yewei-cao,项目名称:noodle,代码行数:5,代码来源:Cart.php

示例12: storeAccessToken

 /**
  * {@inheritDoc}
  */
 public function storeAccessToken($service, TokenInterface $token)
 {
     $name = $this->storageName($service);
     $this->session->put($name, serialize($token));
     return $this;
 }
开发者ID:develme,项目名称:oauth-4-laravel,代码行数:9,代码来源:TokenStorage.php

示例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()]);
 }
开发者ID:xpressengine,项目名称:plugin-board,代码行数:10,代码来源:IdentifyManager.php


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