本文整理汇总了PHP中Illuminate\Session\Store::pull方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::pull方法的具体用法?PHP Store::pull怎么用?PHP Store::pull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Session\Store
的用法示例。
在下文中一共展示了Store::pull方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: message
/**
* 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: pull
/**
* 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: intended
/**
* 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: pull
/**
* {@inheritdoc}
*/
public function pull($index, $default = null)
{
return $this->session->pull($index, $default);
}
示例6: flush
public function flush()
{
return $this->session->pull('__messages', new Collection());
}
示例7: pull
/**
* {@inheritdoc}
*/
public function pull()
{
return $this->session->pull($this->getKey());
}
示例8: sessionEnded
/**
* @return bool
*/
private function sessionEnded()
{
$lastActivityTime = $this->session->pull('lastActivityTime');
return $lastActivityTime && $this->timeExceeded($lastActivityTime);
}
示例9: pull
/**
* Pull the messages.
*
* @param $type
* @return array
*/
public function pull($type)
{
return $this->session->pull($type);
}