當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Store::has方法代碼示例

本文整理匯總了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);
 }
開發者ID:jolupeza,項目名稱:wactas,代碼行數:15,代碼來源:SelectCustomer.php

示例2: getURL

 public function getURL($name)
 {
     if ($this->sessionManager->has($name = $this->getName($name))) {
         return $this->sessionManager->get($name);
     }
     return false;
 }
開發者ID:laravel-commode,項目名稱:navigation-bag,代碼行數:7,代碼來源:NavigationBag.php

示例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;
 }
開發者ID:paul-schulleri,項目名稱:laravel-googletagmanager,代碼行數:16,代碼來源:GoogleTagManagerMiddleware.php

示例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;
 }
開發者ID:tshafer,項目名稱:laravel-flash,代碼行數:15,代碼來源:FlashNotifier.php

示例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;
 }
開發者ID:fastwebmedia,項目名稱:laravel-avp,代碼行數:14,代碼來源:AVPController.php

示例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;
     }
 }
開發者ID:willishq,項目名稱:laravel5-flash,代碼行數:12,代碼來源:Flash.php

示例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);
         }
     }
 }
開發者ID:portonefive,項目名稱:essentials,代碼行數:18,代碼來源:MessageManager.php

示例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);
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:54,代碼來源:FieldPopulator.php

示例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');
     }
 }
開發者ID:artisaninweb,項目名稱:laravel-formvalidation-helper,代碼行數:22,代碼來源:FormBuilder.php

示例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;
 }
開發者ID:FUEL-dev-co,項目名稱:boilerplate,代碼行數:22,代碼來源:Messages.php

示例11: getCart

 /**
  * Get the cart.
  *
  * @return Cart
  */
 public function getCart()
 {
     if ($this->session->has('cart')) {
         return $this->session->get('cart');
     }
     return $this->cart;
 }
開發者ID:JimiOhrid,項目名稱:shopStore,代碼行數:12,代碼來源:CartController.php

示例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');
 }
開發者ID:MarkVaughn,項目名稱:illuminated,代碼行數:15,代碼來源:AlertManager.php

示例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);
 }
開發者ID:nWidart,項目名稱:twitter,代碼行數:29,代碼來源:Twitter.php

示例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);
 }
開發者ID:sharenjoy,項目名稱:cmsharenjoy,代碼行數:8,代碼來源:FlashMessageBag.php

示例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());
 }
開發者ID:ruysu,項目名稱:laravel4-form,代碼行數:16,代碼來源:FormBuilder.php


注:本文中的Illuminate\Session\Store::has方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。