本文整理汇总了PHP中Illuminate\Session\Store::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::has方法的具体用法?PHP Store::has怎么用?PHP Store::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Session\Store
的用法示例。
在下文中一共展示了Store::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$this->session->has('customer_id')) {
return redirect()->to('admin');
}
return $next($request);
}
示例2: getURL
public function getURL($name)
{
if ($this->sessionManager->has($name = $this->getName($name))) {
return $this->sessionManager->get($name);
}
return false;
}
示例3: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->session->has($this->sessionKey)) {
$this->googleTagManager->set($this->session->get($this->sessionKey));
}
$response = $next($request);
$this->session->flash($this->sessionKey, $this->googleTagManager->getFlashData());
return $response;
}
示例4: __construct
/**
* Create a new flash notifier instance.
*
* @param Store $session
*/
public function __construct(Store $session)
{
if ($session->has('flash_notification.messages')) {
$session->forget('flash_notification.messages');
}
if ($session->has('flash_notification.important')) {
$session->forget('flash_notification.important');
}
$this->session = $session;
}
示例5: agegate
/**
* Renders the age gate view
*/
public function agegate()
{
$previousTooYoung = $this->session->get('laravel-avp.previous_too_young');
$view = view(config('agegate.view'))->with(compact('previousTooYoung'));
if (!$this->session->has('errors') && $previousTooYoung) {
$messages = $this->lang->get('laravel-avp::validation.custom');
$errorMsg = $messages['dob.previous'];
$view->withErrors(['dob' => [$errorMsg]]);
}
return $view;
}
示例6: __construct
public function __construct(Store $session, Factory $view)
{
$this->session = $session;
$view->share('flash', $this);
if ($this->session->has($this->namespace)) {
$flashed = $this->session->get($this->namespace);
$this->message = $flashed['message'];
$this->title = $flashed['title'];
$this->type = $flashed['type'];
$this->exists = true;
}
}
示例7: Collection
/**
* Create a new flash notifier instance.
*
* @param Store $session
* @param Application $app
*/
function __construct(Store $session, Application $app)
{
$this->session = $session;
$this->app = $app;
$this->messages = $this->session->pull('__messages', new Collection());
if ($this->session->has('errors')) {
$errors = $this->session->get('errors')->getBag('default')->getMessages();
foreach ($errors as $error) {
$this->add(['message' => current($error), 'type' => 'info', 'class' => 'warning'], false);
}
}
}
示例8: populate
/**
* Populate the fields with entry values.
*
* @param FormBuilder $builder
*/
public function populate(FormBuilder $builder)
{
$fields = $builder->getFields();
$entry = $builder->getFormEntry();
foreach ($fields as &$field) {
/*
* If the field is not already set
* then get the value off the entry.
*/
if (!isset($field['value']) && $entry instanceof EloquentModel && $entry->getId()) {
if ($locale = array_get($field, 'locale')) {
$field['value'] = $entry->translateOrDefault($locale)->{$field['field']};
} else {
$field['value'] = $entry->{$field['field']};
}
}
/*
* If the field has a default value
* and the entry does not exist yet
* then use the default value.
*/
if (isset($field['config']['default_value']) && $entry instanceof EloquentModel && !$entry->getId()) {
$field['value'] = $field['config']['default_value'];
}
/*
* If the field has a default value
* and there is no entry then
* use the default value.
*/
if (isset($field['config']['default_value']) && !$entry) {
$field['value'] = $field['config']['default_value'];
}
/*
* If the field is an assignment then
* use it's config for the default value.
*/
if (!isset($field['value']) && $entry instanceof EntryInterface && ($type = $entry->getFieldType($field['field']))) {
$field['value'] = array_get($type->getConfig(), 'default_value');
}
/*
* Lastly if we have flashed data from a front end
* form handler then use that value for the field.
*/
if ($this->session->has($field['prefix'] . $field['field'])) {
$field['value'] = $this->session->pull($field['prefix'] . $field['field']);
}
}
$builder->setFields($fields);
}
示例9: __construct
/**
* The constructor
*
* @param HtmlBuilder $html
* @param UrlGenerator $url
* @param Session $session
*/
public function __construct(HtmlBuilder $html, UrlGenerator $url, Session $session)
{
parent::__construct($html, $url, $session->getToken());
$this->session = $session;
$this->requiredFields = [];
$this->errorFields = [];
if ($this->session->has('formhelper-required-fields')) {
$this->requiredFields = $this->session->get('formhelper-required-fields');
$this->session->forget('formhelper-required-fields');
}
if ($this->session->has('formhelper-error-fields')) {
$this->errorFields = $this->session->get('formhelper-error-fields');
$this->session->forget('formhelper-error-fields');
}
}
示例10: retrieve
/**
* Retrieve Message instance from Session, the data should be in
* serialize, so we need to unserialize it first.
*
* @return self
*/
public function retrieve()
{
$messages = null;
if (!isset($this->instance)) {
$this->instance = new static();
$this->instance->setSessionStore($this->session);
if ($this->session->has('message')) {
$messages = @unserialize($this->session->get('message', ''));
}
$this->session->forget('message');
if (is_array($messages)) {
$this->instance->merge($messages);
}
}
return $this->instance;
}
示例11: getCart
/**
* Get the cart.
*
* @return Cart
*/
public function getCart()
{
if ($this->session->has('cart')) {
return $this->session->get('cart');
}
return $this->cart;
}
示例12: prepareAndGet
/**
* Prepare and get the alert collection.
*
* Here we make sure that the alerts collection is in the session
* store. If it's not, then we will go ahead an create a new one
*
* @return Collection
*/
protected function prepareAndGet()
{
if (!$this->session->has('chromabits.alerts')) {
$this->session->set('chromabits.alerts', new Collection());
}
return $this->session->get('chromabits.alerts');
}
示例13: __construct
public function __construct($config = [], SessionStore $session)
{
if (is_array($config['ttwitter::config'])) {
$this->tconfig = $config['ttwitter::config'];
} else {
if (is_array($config['ttwitter'])) {
$this->tconfig = $config['ttwitter'];
} else {
throw new Exception('No config found');
}
}
$this->debug = isset($this->tconfig['debug']) && $this->tconfig['debug'] ? true : false;
$this->parent_config = [];
$this->parent_config['consumer_key'] = $this->tconfig['CONSUMER_KEY'];
$this->parent_config['consumer_secret'] = $this->tconfig['CONSUMER_SECRET'];
$this->parent_config['token'] = $this->tconfig['ACCESS_TOKEN'];
$this->parent_config['secret'] = $this->tconfig['ACCESS_TOKEN_SECRET'];
if ($session->has('access_token')) {
$access_token = $session->get('access_token');
if (is_array($access_token) && isset($access_token['oauth_token']) && isset($access_token['oauth_token_secret']) && !empty($access_token['oauth_token']) && !empty($access_token['oauth_token_secret'])) {
$this->parent_config['token'] = $access_token['oauth_token'];
$this->parent_config['secret'] = $access_token['oauth_token_secret'];
}
}
$this->parent_config['use_ssl'] = $this->tconfig['USE_SSL'];
$this->parent_config['user_agent'] = 'LTTW ' . parent::VERSION;
$config = array_merge($this->parent_config, $this->tconfig);
parent::__construct($this->parent_config);
}
示例14: __construct
public function __construct(Store $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: __construct
/**
* Class constructor.
*
* @param Illuminate\Html\FormBuilder $builder
* @param Illuminate\Http\Request $request
* @param Illuminate\Session\Store $session
*/
public function __construct(Builder $builder, Request $request, Session $session)
{
$this->builder = $builder;
$this->request = $request;
$this->fields = new FieldCollection();
$this->fields->setNamespace($this->namespace);
$this->fields->setBuilder($this->builder);
$this->fields->setErrorBag($session->has('errors') ? $session->get('errors')->getBag($this->namespace) : new MessageBag());
}