/** * @param NotificationRepository $repository * * @return \Illuminate\Database\Eloquent\Model */ public function handle(NotificationRepository $repository) { $notification = $repository->instance(); $notification->withType($this->type); $notification->withMessage($this->message); if (!is_null($user = auth()->user())) { $notification->from($user); } if (!is_null($this->object)) { $notification->regarding($this->object); } $notification->withParameters($this->parameters); $notification->deliver([$this->users]); Event::listen('notification.send', [$notification]); return $notification; }
/** * @param NotificationRepository $repository */ public function deleteRead(NotificationRepository $repository) { $id = $this->getRequiredParameter('id'); $repository->markRead($id, $this->currentUser); $this->setContent(true); }