本文整理汇总了PHP中Illuminate\Session\SessionManager::get方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::get方法的具体用法?PHP SessionManager::get怎么用?PHP SessionManager::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Session\SessionManager
的用法示例。
在下文中一共展示了SessionManager::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* @param Organization $organization
* @param User $user
* @param SessionManager $sessionManager
*/
function __construct(Organization $organization, User $user, SessionManager $sessionManager)
{
$this->organization = $organization;
$this->user = $user;
$this->sessionManager = $sessionManager;
$this->orgId = $this->sessionManager->get('org_id');
}
示例2: render
/**
* Render the notifications' script tag
*
* @return string
* @internal param bool $flashed Whether to get the
*
*/
public function render()
{
$notifications = $this->session->get('toastr::notifications');
if (!$notifications) {
$notifications = [];
}
$output = '<script type="text/javascript">';
$lastConfig = [];
foreach ($notifications as $notification) {
$config = $this->config->get('toastr.options');
if (count($notification['options']) > 0) {
// Merge user supplied options with default options
$config = array_merge($config, $notification['options']);
}
// Config persists between toasts
if ($config != $lastConfig) {
$output .= 'toastr.options = ' . json_encode($config) . ';';
$lastConfig = $config;
}
// Toastr output
$output .= 'toastr.' . $notification['type'] . "('" . str_replace("'", "\\'", str_replace(['<', '>'], ['<', '>'], e($notification['message']))) . "'" . (isset($notification['title']) ? ", '" . str_replace("'", "\\'", htmlentities($notification['title'])) . "'" : null) . ');';
}
$output .= '</script>';
return $output;
}
示例3: preSet
public function preSet(FormEvent $event)
{
$form = $event->getForm();
$rootName = $form->getRoot()->getName();
if (!$form->isRoot() && ($parent = $form->getParent())) {
$name = $this->getDottedName($form);
$fullName = $this->getFullName($rootName, $name);
// Add input from the previous submit
if ($form->getName() !== '_token' && $this->session->hasOldInput($fullName)) {
// Get old value
$value = $this->session->getOldInput($fullName);
// Transform back to good data
$value = $this->transformValue($event, $value);
// Store on the form
$event->setData($value);
}
if ($this->session->has('errors')) {
/** @var \Illuminate\Support\ViewErrorBag $errors */
$errors = $this->session->get('errors');
if ($errors->has($name)) {
$form->addError(new FormError(implode(' ', $errors->get($name))));
}
}
}
}
示例4: __construct
public function __construct()
{
$this->sessionManager = app(SessionManager::class);
if ($this->sessionManager->has('flash_messages')) {
$this->messages = $this->sessionManager->get('flash_messages');
}
}
示例5: retrieveAccessToken
/**
* {@inheritDoc}
*/
public function retrieveAccessToken($service)
{
$name = $this->storageName($service);
if ($token = $this->session->get($name)) {
return unserialize($token);
}
throw new TokenNotFoundException('Token not found in session, are you sure you stored it?');
}
示例6: getValueForSection
public function getValueForSection($section, $key = null, $default = null)
{
$values = $this->sessionManager->get($section);
if (!$key) {
return $values;
}
return isset($values[$key]) ? $values[$key] : $default;
}
示例7: check
/**
* Check if string matches captcha
* @param $string
* @param $formId
* @return bool
*/
public function check($string, $formId = null)
{
if (empty($formId)) {
//$formId = $this->fromCurrentUrl();
$formId = $this->fromAppKey();
}
$hash = $this->session->get("{$this->storeKey}.{$formId}");
return $this->hash($this->config->get('captcha.case_sensitive') ? $string : strtolower($string)) == $hash;
}
示例8: getRecentAuthData
/**
* Allows you retrieve the most recent social provider
* authorized with.
*
* @return mixed
*/
public function getRecentAuthData()
{
$providers = $this->session->get('__sp_auth.p');
if (!$providers) {
return null;
}
return array_first($providers, function ($provider) {
return $provider === $this->session->get('__sp_auth.r');
});
}
示例9: session
/**
* Get session.
*
* @param string|null $key
* @param mixed $default
*
* @return \Illuminate\Session\SessionManager|mixed
*/
public function session($key = null, $default = null)
{
if (!isset($this->session)) {
$this->session = app('session');
}
if (is_null($key)) {
return $this->session;
}
return $this->session->get($key, $default);
}
示例10:
/**
* @param Activity $activity
* @param IatiIdentifierManager $iatiIdentifierManager
* @param Identifier $identifier
* @param OrganizationManager $organizationManager
* @param SessionManager $sessionManager
* @param ActivityManager $activityManager
*/
function __construct(Activity $activity, IatiIdentifierManager $iatiIdentifierManager, Identifier $identifier, OrganizationManager $organizationManager, SessionManager $sessionManager, ActivityManager $activityManager)
{
$this->middleware('auth');
$this->activity = $activity;
$this->iatiIdentifierManager = $iatiIdentifierManager;
$this->identifier = $identifier;
$this->organizationManager = $organizationManager;
$this->sessionManager = $sessionManager;
$this->organization_id = $this->sessionManager->get('org_id');
$this->activityManager = $activityManager;
}
示例11:
/**
* @param OrganizationManager $organizationManager
* @param SessionManager $sessionManager
* @param ActivityManager $activityManager
* @param UploadActivityManager $uploadActivityManager
* @param UploadActivity $uploadActivity
* @param SettingsManager $settingsManager
*/
function __construct(OrganizationManager $organizationManager, SessionManager $sessionManager, ActivityManager $activityManager, UploadActivityManager $uploadActivityManager, UploadActivity $uploadActivity, SettingsManager $settingsManager)
{
$this->middleware('auth');
$this->activityManager = $activityManager;
$this->uploadActivity = $uploadActivity;
$this->uploadActivityManager = $uploadActivityManager;
$this->sessionManager = $sessionManager;
$this->organizationId = $this->sessionManager->get('org_id');
$this->organizationManager = $organizationManager;
$this->settingsManager = $settingsManager;
}
示例12: 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);
}
}
示例13: getuserfolder
function getuserfolder()
{
$session = new Session('demo');
if ($session->has('userfolder')) {
$value = $session->get('userfolder');
}
return $value;
}
示例14: __construct
public function __construct(SessionManager $session, $messages = array())
{
$this->session = $session;
if ($session->has($this->session_key)) {
$messages = array_merge_recursive($session->get($this->session_key), $messages);
}
parent::__construct($messages);
}
示例15: getPersistentData
/**
* {@inheritdoc}
*
* @see BaseFacebook::getPersistentData()
*/
protected function getPersistentData($key, $default = false)
{
if (!in_array($key, self::$kSupportedKeys)) {
self::errorLog('Unsupported key passed to getPersistentData.');
return $default;
}
$session_var_name = $this->constructSessionVariableName($key);
return $this->laravelSession->get($session_var_name, $default);
}