/** * Handle the event. * * @param Event|TopicUpVoted $event */ public function handle(Event $event) { $data = ['topic_id' => $event->getTopicId(), 'body' => $event->getBody(), 'from_user_id' => $event->getFromUserId(), 'user_id' => $event->getUserId(), 'type' => $event->getType(), 'reply_id' => $event->getReplyId()]; $notification = $this->notifications->store($data); $presenter = app('autopresenter')->decorate($notification); $push_data = array_only($data, ['topic_id', 'from_user_id', 'type']); if ($data['reply_id'] !== 0) { $push_data['reply_id'] = $data['reply_id']; $push_data['replies_url'] = route('replies.web_view', $data['topic_id']); } $this->push($event->getUserId(), $presenter->message(), $push_data); }