I have set up notifications so that when a user comments on another users post the owner of the post receives a notification to let them know of the comment.
but at the moment the notification just says displays what is added to the return statement in the following:
public function toArray($notifiable) {
return [
'data' => 'Test notification'
];
}
But when a user posts a comment i want to replace the 'Test notification' with the following:
the name of the user that commented on the post saying for example:
'John commented on your post'
how do i do this so that it always displays the users name of the person thats commented.
if this helps i have passed in the user, comment and post at the top in the construct function like this:
public function __construct(User $user, Post $post, Comment $comment) {
$this->user = $user;
$this->comment = $comment;
$this->post = $post;
}