/** * Execute this event to flash messages. * * @param Notification $notification * @param NotificationsBag $notificationBag * @param Message $message * @return bool */ public function onFlash(Notification $notification, NotificationsBag $notificationBag, Message $message) { $this->flashContainerNames($notification); $sessionKey = $this->getConfig()->get('notification.session_prefix'); $sessionKey .= $notificationBag->getName(); $sessionKey .= '_' . $this->generateMessageKey($message); $this->getSession()->flash($sessionKey, $message->toJson()); return true; }
/** * Fire given event. * * @param $event * @param \Krucas\Notification\NotificationsBag $notificationBag * @param \Krucas\Notification\Message $message * @return array|bool|null */ public function fire($event, NotificationsBag $notificationBag, Message $message) { if (!isset(static::$dispatcher)) { return true; } $event = "notification.{$event}: " . $notificationBag->getName(); return static::$dispatcher->fire($event, array($this, $notificationBag, $message)); }
/** * Execute this event to flash messages. * * @param Notification $notification * @param NotificationsBag $notificationBag * @param Message $message * @return bool */ public function onFlash(Notification $notification, NotificationsBag $notificationBag, Message $message) { $key = implode('.', [$this->key, $notificationBag->getName()]); $this->session->push($key, $message); return true; }