/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $this->repository->addAvailableInclude('from_user', ['name', 'avatar']);
     $this->repository->addAvailableInclude('reply', ['created_at']);
     $this->repository->addAvailableInclude('topic', ['title']);
     $data = $this->repository->autoWith()->autoWithRootColumns(['id', 'type', 'body', 'topic_id', 'reply_id', 'created_at'])->paginate(per_page());
     return $this->response()->paginator($data, new NotificationTransformer());
 }
 /**
  * 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);
 }