コード例 #1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $containerNames = $this->session->get($this->sessionPrefix . 'containers', array());
     $sessionVariables = $this->session->all();
     foreach ($containerNames as $containerName) {
         foreach ($sessionVariables as $sessionKey => $value) {
             if (strpos($sessionKey, $this->sessionPrefix . $containerName) === 0 && is_string($value)) {
                 $jsonMessage = json_decode($value);
                 $this->notification->container($containerName)->add($jsonMessage->type, new Message($jsonMessage->type, $jsonMessage->message, false, $jsonMessage->format, $jsonMessage->alias, $jsonMessage->position), false);
             }
         }
     }
     return $next($request);
 }
コード例 #2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $containers = $this->session->get($this->key, []);
     if (count($containers) > 0) {
         foreach ($containers as $name => $messages) {
             /** @var \Krucas\Notification\Message $message */
             foreach ($messages as $message) {
                 $this->notification->container($name)->add($message->getType(), $message, false);
             }
         }
     }
     $this->session->forget($this->key);
     return $next($request);
 }
コード例 #3
0
ファイル: Subscriber.php プロジェクト: hilmysyarif/phpv8
 /**
  * Execute this event when notification package is booted.
  * Load flash messages and add them as instant.
  *
  * @param Notification $notification
  * @return bool
  */
 public function onBoot(Notification $notification)
 {
     $sessionPrefix = $this->getConfig()->get('notification::session_prefix');
     $containerNames = $this->getSession()->get($sessionPrefix . 'containers', array());
     $sessionVariables = $this->getSession()->all();
     foreach ($containerNames as $containerName) {
         foreach ($sessionVariables as $sessionKey => $value) {
             if (strpos($sessionKey, $sessionPrefix . $containerName) === 0 && is_string($value)) {
                 $jsonMessage = json_decode($value);
                 $notification->container($containerName)->add($jsonMessage->type, new Message($jsonMessage->type, $jsonMessage->message, false, $jsonMessage->format, $jsonMessage->alias, $jsonMessage->position), false);
             }
         }
     }
     return true;
 }
コード例 #4
0
ファイル: _ide_helper.php プロジェクト: phillipmadsen/deved
 /**
  * Returns container instance.
  *
  * @param null $container
  * @param callable $callback
  * @return mixed 
  * @static 
  */
 public static function container($container = null, $callback = null)
 {
     return \Krucas\Notification\Notification::container($container, $callback);
 }