コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
ファイル: FlashNotifier.php プロジェクト: phaza/Laravel-Flash
 /**
  * Flash a general message.
  *
  * @param string $message
  * @param string $level
  * @param bool   $overlay
  *
  * @return $this
  */
 public function message($message, $level = 'info', $title = 'Notice', $overlay = false)
 {
     $messages = $this->session->pull('flash_notification.messages', []);
     $messages[] = compact('message', 'level', 'title', 'overlay');
     $this->session->flash('flash_notification.messages', $messages);
     return $this;
 }
コード例 #3
0
ファイル: _ide_helper.php プロジェクト: satriashp/tour
 /**
  * Get the value of a given key and then forget it.
  *
  * @param string $key
  * @param string $default
  * @return mixed 
  * @static 
  */
 public static function pull($key, $default = null)
 {
     return \Illuminate\Session\Store::pull($key, $default);
 }
コード例 #4
0
ファイル: Redirector.php プロジェクト: illuminate/routing
 /**
  * Create a new redirect response to the previously intended location.
  *
  * @param  string  $default
  * @param  int     $status
  * @param  array   $headers
  * @param  bool    $secure
  * @return \Illuminate\Http\RedirectResponse
  */
 public function intended($default = '/', $status = 302, $headers = [], $secure = null)
 {
     $path = $this->session->pull('url.intended', $default);
     return $this->to($path, $status, $headers, $secure);
 }
コード例 #5
0
ファイル: Session.php プロジェクト: xaamin/session
 /**
  * {@inheritdoc}
  */
 public function pull($index, $default = null)
 {
     return $this->session->pull($index, $default);
 }
コード例 #6
0
 public function flush()
 {
     return $this->session->pull('__messages', new Collection());
 }
コード例 #7
0
ファイル: Session.php プロジェクト: shinichi81/whatsapi-1
 /**
  * {@inheritdoc}
  */
 public function pull()
 {
     return $this->session->pull($this->getKey());
 }
コード例 #8
0
ファイル: SessionTimeout.php プロジェクト: Hasnayeen/blog
 /**
  * @return bool
  */
 private function sessionEnded()
 {
     $lastActivityTime = $this->session->pull('lastActivityTime');
     return $lastActivityTime && $this->timeExceeded($lastActivityTime);
 }
コード例 #9
0
 /**
  * Pull the messages.
  *
  * @param $type
  * @return array
  */
 public function pull($type)
 {
     return $this->session->pull($type);
 }