notificationPref('notif_new_comment')) $ch[] = 'database'; if ($notifiable->notificationPref('email_new_comment')) $ch[] = 'mail'; return $ch; } public function toArray(object $notifiable): array { return [ 'type' => 'new_comment', 'video_id' => $this->video->id, 'video_route_key' => $this->video->getRouteKey(), 'video_title' => $this->video->title, 'video_thumbnail' => $this->video->thumbnail, 'actor_id' => $this->commenter->id, 'actor_name' => $this->commenter->name, 'actor_avatar' => $this->commenter->avatar_url, 'comment_preview' => Str::limit($this->comment->body, 80), ]; } public function toMail(object $notifiable): MailMessage { return (new MailMessage) ->subject($this->commenter->name . ' commented on your video') ->view('emails.new-comment', [ 'video' => $this->video, 'comment' => $this->comment, 'commenter'=> $this->commenter, 'recipient'=> $notifiable, ]); } }