本文整理汇总了PHP中Illuminate\Session\Store::flash方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::flash方法的具体用法?PHP Store::flash怎么用?PHP Store::flash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Session\Store
的用法示例。
在下文中一共展示了Store::flash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flash
/**
* Store the messages in the current session.
*/
public function flash()
{
if (static::$session) {
static::$session->flash($this->getSessionKey(), $this);
}
return $this;
}
示例2: message
/**
* Setup the flash messsage data.
*
* @param string $message
* @param string $title
* @param string $level
*/
protected function message($message, $title = '', $type = 'info')
{
$this->message = $message;
$this->title = $title;
$this->type = $type;
$this->session->flash($this->namespace, (array) $this);
}
示例3: flash
/**
* Set a session key and value.
*
* @param mixed $key
* @param string $data
*
* @return mixed
*/
public function flash($key, $data = null)
{
if (is_array($key)) {
return $this->flashMany($key);
}
return $this->session->flash($key, $data);
}
示例4: add
public function add(array $message, $flash = true)
{
$this->messages->push($message);
if ($flash) {
$this->session->flash('__messages', $this->messages);
}
return $this;
}
示例5: flash
/**
* Flash a message to the session.
*
* @param string|array $key
* @param mixed $value
*/
public function flash($key, $value = null)
{
if (is_array($key)) {
$this->flashMany($key);
return;
}
$this->session->flash($key, $value);
}
示例6: 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;
}
示例7: message
/**
* @param $message
* @param string $level
*/
public function message($message, $level = 'info')
{
$notification = new \stdClass();
$notification->message = $message;
$notification->level = $level;
$notifications = $this->session->get('flash_notifications', []);
array_push($notifications, $notification);
$this->session->flash('flash_notifications', $notifications);
}
示例8: with
/**
* Flash a piece of data to the session.
*
* @param string $key
* @param mixed $value
* @return \Illuminate\Http\RedirectResponse
*/
public function with($key, $value = null)
{
if (is_array($key)) {
foreach ($key as $k => $v) {
$this->with($k, $v);
}
} else {
$this->session->flash($key, $value);
}
return $this;
}
示例9: add
/**
* Adds one or more messages
*
* @param string $group The name of the group to add the message(s) to
* @param string|string[] $messages The message(s) to add to the specified group
* @param bool $flash Whether to flash the message(s) for the next request
*
* @return void
*/
public function add($group, $messages = '', $flash = false)
{
$messages = (array) $messages;
if ($flash) {
if (!isset($this->newFlashMessages[$group])) {
$this->newFlashMessages[$group] = array();
}
$this->newFlashMessages[$group] = array_merge($this->newFlashMessages[$group], $messages);
$this->store->flash($this->flashContainerName, $this->newFlashMessages);
} else {
if (!isset($this->messages[$group])) {
$this->messages[$group] = array();
}
$this->messages[$group] = array_merge($this->messages[$group], $messages);
}
}
示例10: 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;
}
示例11: handle
/**
* Handle the event.
*
* @param Store $session
*/
public function handle(Store $session)
{
/* @var FieldType $field */
foreach ($this->builder->getFormFields() as $field) {
$session->flash($field->getFieldName(), $field->getPostValue());
}
}
示例12: getLogout
/**
* Logout
*
* If you're actually logged in, it'll log you out and show a message.
* Else it will silently redirect you to the login form.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function getLogout()
{
if ($this->sentry->check()) {
$this->sentry->logout();
$this->session->flash('success', 'You have successfully logged out.');
}
return $this->redirect->route('larapress.home.login.get');
}
示例13: redirectWithFlashMessage
/**
* Set a flash message and either redirect to a given route or the last page
*
* @param string $key The session flash message key
* @param string $message The session flash message value
* @param string|null $route The Route name to redirect to (can be left empty to just redirect back)
* @param array $parameters Parameters for the route (See the Laravel documentation)
* @param int $status Status code for the route (See the Laravel documentation)
* @param array $headers Headers for the route (See the Laravel documentation)
* @return \Illuminate\HTTP\RedirectResponse
*/
public function redirectWithFlashMessage($key, $message, $route = null, $parameters = array(), $status = 302, $headers = array())
{
$this->session->flash($key, $message);
if (!is_null($route)) {
return $this->redirect->route($route, $parameters = array(), $status = 302, $headers = array());
}
return $this->redirect->back();
}
示例14: with
/**
* Flash a piece of data to the session.
*
* @param string $key
* @param mixed $value
* @return \Illuminate\Http\RedirectResponse
*/
public function with($key, $value = null)
{
$key = is_array($key) ? $key : [$key => $value];
foreach ($key as $k => $v) {
$this->session->flash($k, $v);
}
return $this;
}
示例15: subscribeAction
/**
* Handle the subscription form request
*/
public function subscribeAction()
{
try {
$this->subscribeForm->validate($this->app->request()->params());
} catch (FormValidationException $e) {
$this->session->flash('message', 'Oh no, you have entered invalid data. Please correct your input and try again.');
$this->session->flash('errors', $e->getErrors());
$this->session->flash('input', $this->app->request()->params());
$this->app->response->redirect($this->app->urlFor('home'));
return;
}
//
// TODO: Subscribe the client to your newsletter list... or stuff
//
$this->session->flash('message', 'Thanks for your request. You have successfully subscribed for our newsletter.');
$this->app->response->redirect($this->app->urlFor('home'));
}