コード例 #1
0
ファイル: AlertBag.php プロジェクト: iyoworks/support
 /**
  * Store the messages in the current session.
  */
 public function flash()
 {
     if (static::$session) {
         static::$session->flash($this->getSessionKey(), $this);
     }
     return $this;
 }
コード例 #2
0
ファイル: Flash.php プロジェクト: willishq/laravel5-flash
 /**
  * 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
0
ファイル: Session.php プロジェクト: sepgg/notify
 /**
  * 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
0
 public function add(array $message, $flash = true)
 {
     $this->messages->push($message);
     if ($flash) {
         $this->session->flash('__messages', $this->messages);
     }
     return $this;
 }
コード例 #5
0
ファイル: Session.php プロジェクト: arcanedev/notify
 /**
  * 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);
 }
 /**
  * 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
0
ファイル: FlashNotifier.php プロジェクト: ahk-ch/chamb.net
 /**
  * @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
0
 /**
  * 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
0
ファイル: Messagely.php プロジェクト: wibleh/messagely
 /**
  * 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
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;
 }
コード例 #11
0
 /**
  * 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
0
ファイル: HomeController.php プロジェクト: LaraGit/larapress
 /**
  * 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
0
ファイル: Helpers.php プロジェクト: LaraGit/larapress
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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'));
 }
コード例 #16
0
 /**
  * stores the flash notification to session
  *
  * @param string $message
  * @param string $level
  * @param bool $overlay
  */
 private function _storeNotificationToSession($message, $level, $overlay = false)
 {
     $message = $this->translateMessage($message);
     $this->session->flash('flash_notification.message', $message);
     $this->session->flash('flash_notification.level', $level);
     if ($overlay) {
         $this->session->flash('flash_notification.overlay', true);
     }
 }
コード例 #17
0
ファイル: UrlsController.php プロジェクト: elvios/darkshare
 /**
  * Authenticate to a protected snippet.
  *
  * @param Url                       $url
  * @param \Illuminate\Http\Request  $request
  * @param \Illuminate\Session\Store $session
  * @return \Illuminate\Http\RedirectResponse
  */
 public function authenticate(Url $url, Request $request, Store $session)
 {
     if (!$url->authenticate($request->input('password'))) {
         flash()->warning('Wrong password');
         return redirect()->back();
     }
     $session->flash('urls_auth', true);
     return redirect()->route('urls.show', $url->slug->slug);
 }
コード例 #18
0
ファイル: FlashNotifier.php プロジェクト: znck/flash
 /**
  * Flash a general message.
  *
  * @param string $message
  * @param string $level
  *
  * @return $this
  */
 public function message($message, $level = 'info')
 {
     $key = md5($message . $level);
     $sort = array_get($this->levels, $level, 0);
     $level = array_get($this->classes, $level, 'info');
     $this->messages->put($key, compact('message', 'level', 'sort'));
     $this->session->flash($this->getFlashSessionKey(), $this->messages);
     return $this;
 }
コード例 #19
0
ファイル: Toastr.php プロジェクト: artdarek/toastr
 /**
  * Push notifications array to session
  */
 public function push()
 {
     $this->alert['params'] = $this->params;
     $this->notifications[] = $this->alert;
     // store in session
     $this->session->flash('toastr.alerts', $this->notifications);
     // unset
     $this->alert = [];
     $this->params = [];
 }
コード例 #20
0
 /**
  *
  * THIS IS PRETTY SHIT BUT I'VE GOT STUFF TO DO YO
  *
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function register(Request $request, Session $session)
 {
     $session->flash("authRoute", 'register');
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     Auth::guard($this->getGuard())->login($this->create($request->all()));
     return redirect($this->redirectPath());
 }
コード例 #21
0
 /**
  * @param $message
  * @param string $level
  * @param string $title
  * @param bool   $overlay
  *
  * @return $this
  */
 public function message($message, $level = 'info', $title = 'Notice', $overlay = false)
 {
     if (is_array($message)) {
         $message = new MessageBag($message);
     }
     $values = $this->session->get('flash_notification.messages', []);
     $values[] = compact('message', 'level', 'title', 'overlay');
     $this->session->flash('flash_notification.messages', $values);
     return $this;
 }
コード例 #22
0
 function it_has_convenience_methods_for_other_types_of_messages(Store $store)
 {
     $store->flash('flashi.message', 'Success Message')->shouldBeCalled();
     $store->flash('flashi.type', 'success')->shouldBeCalled();
     $this->success('Success Message');
     $store->flash('flashi.message', 'Warning Message')->shouldBeCalled();
     $store->flash('flashi.type', 'warning')->shouldBeCalled();
     $this->warning('Warning Message');
     $store->flash('flashi.message', 'Danger Message')->shouldBeCalled();
     $store->flash('flashi.type', 'danger')->shouldBeCalled();
     $this->danger('Danger Message');
     $store->flash('flashi.message', 'Info Message')->shouldBeCalled();
     $store->flash('flashi.type', 'info')->shouldBeCalled();
     $this->info('Info Message');
 }
コード例 #23
0
 public function update(Request $request, Store $session)
 {
     $validator = $this->updater->validator($request->user(), $request->all());
     if ($validator->fails()) {
         if ($request->ajax()) {
             $session->flash('errors', $validator->getMessageBag());
             return response('', 500);
         }
         return redirect(route('user.profile.edit'))->withErrors($validator);
     }
     $this->updater->update($request->user(), $request->all());
     if ($request->ajax()) {
         // very default response, we basicly just need the response code
         return response('', 200);
     }
     return redirect()->route('user.profile', ['id' => $request->user()->id]);
 }
コード例 #24
0
ファイル: _ide_helper.php プロジェクト: satriashp/tour
 /**
  * Flash a key / value pair to the session.
  *
  * @param string $key
  * @param mixed $value
  * @return void 
  * @static 
  */
 public static function flash($key, $value)
 {
     \Illuminate\Session\Store::flash($key, $value);
 }
コード例 #25
0
ファイル: FlashNotifier.php プロジェクト: nmkr/basic-starter
 /**
  * @param $message
  * @param string $level
  */
 public function message($message, $level = 'info')
 {
     $this->session->flash('flash_notification.message', $message);
     $this->session->flash('flash_notification.level', $level);
 }
コード例 #26
0
 /**
  * Flash a container of errors to the session.
  *
  * @param  \Illuminate\Contracts\Support\MessageProvider|array|string  $provider
  * @param  string  $key
  * @return $this
  */
 public function withErrors($provider, $key = 'default')
 {
     $value = $this->parseErrors($provider);
     $this->session->flash('errors', $this->session->get('errors', new ViewErrorBag())->put($key, $value));
     return $this;
 }
コード例 #27
0
 /**
  * @param string $key
  * @param mixed $value
  */
 public function flash($key, $value)
 {
     $this->session->flash($key, $value);
 }
コード例 #28
0
 /**
  * Flash a value to the session
  *
  * @param  string $name
  * @param  mixed  $value
  * @return mixed
  */
 public function flash($name, $value)
 {
     return $this->session->flash($name, $value);
 }
コード例 #29
0
ファイル: Session.php プロジェクト: xaamin/session
 /**
  * {@inheritdoc}
  */
 public function flash($index, $value = null)
 {
     $this->session->flash($index, $value);
 }
コード例 #30
0
 /**
  * Flash a message to the session.
  *
  * @param $name
  * @param $data
  */
 public function flash($name, $data)
 {
     $this->session->flash($name, $data);
 }