本文整理汇总了PHP中Illuminate\Session\SessionManager::has方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::has方法的具体用法?PHP SessionManager::has怎么用?PHP SessionManager::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Session\SessionManager
的用法示例。
在下文中一共展示了SessionManager::has方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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))));
}
}
}
}
示例2: __construct
public function __construct()
{
$this->sessionManager = app(SessionManager::class);
if ($this->sessionManager->has('flash_messages')) {
$this->messages = $this->sessionManager->get('flash_messages');
}
}
示例3: 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);
}
}
示例4: hasMessage
public function hasMessage()
{
if (!$this->session->has('message')) {
return false;
}
return true;
}
示例5: getuserfolder
function getuserfolder()
{
$session = new Session('demo');
if ($session->has('userfolder')) {
$value = $session->get('userfolder');
}
return $value;
}
示例6: __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);
}
示例7: clearPersistentData
/**
* {@inheritdoc}
*
* @see BaseFacebook::clearPersistentData()
*/
protected function clearPersistentData($key)
{
if (!in_array($key, self::$kSupportedKeys)) {
self::errorLog('Unsupported key passed to clearPersistentData.');
return;
}
$session_var_name = $this->constructSessionVariableName($key);
if ($this->laravelSession->has($session_var_name)) {
$this->laravelSession->forget($session_var_name);
}
}
示例8: identified
/**
* 문서에 대해서 인증한 세션이 있는지 체크
*
* @param ItemEntity $item board item entity
* @return bool
*/
public function identified(ItemEntity $item)
{
$sessionName = $this->getKey($item->id);
if ($this->session->has($sessionName) === false) {
return false;
}
if ($this->validate($item) === false) {
return false;
}
// 세션 갱신
$this->destroy($item);
$this->create($item);
return true;
}
示例9: identified
/**
* 문서에 대해서 인증한 세션이 있는지 체크
*
* @param Board $board board model
* @return bool
*/
public function identified(Board $board)
{
$sessionName = $this->getKey($board->id);
if ($this->session->has($sessionName) === false) {
return false;
}
if ($this->validate($board) === false) {
return false;
}
// 세션 갱신
$this->destroy($board);
$this->create($board);
return true;
}
示例10: edit
/**
* Shows the form for item editing.
*
* @param string $model Model to use.
* @param int $id Item ID.
* @return \Illuminate\Http\Response
*/
public function edit($model, $id)
{
$this->setModel($model);
$this->checkAction('edit');
$item = $this->staticModelgetFormItem($id);
if (!$item) {
abort(404);
}
$title = trans('lavanda::common.edit_title', ['entity' => mb_strtolower($this->staticModelGetName()), 'id' => $id]);
$form = $this->staticModelGetForm('put', $this->getRoute('update', ['id' => $id]), $this->session->hasOldInput() ? null : $item);
if (!$this->session->has('back_url')) {
$this->session->flash('back_url', $this->request->server('HTTP_REFERER'));
} else {
$this->session->reflash();
}
return view('lavanda::entity.edit', ['title' => $title, 'form' => $form]);
}
示例11: 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);
}
}
示例12: getContent
/**
* Get the carts content, if there is no cart content set yet, return a new empty Collection
*
* @return CartCollection
*/
protected function getContent()
{
$content = $this->session->has($this->getInstance()) ? $this->session->get($this->getInstance()) : new CartCollection();
return $content;
}
示例13: hasAccessToken
/**
* {@inheritDoc}
*/
public function hasAccessToken($service)
{
$name = $this->storageName($service);
return $this->session->has($name);
}