I'm trying to get a users email and use it in my html code but I'm not sure how to do this, at the moment this is my code:
public function toArray($notifiable)
{
return [
'data' => $this->user->name. ' commented on your post',
];
}
I am able to use the first line 'data'...
in the following way:
{{ $notification->data['data'] }}
but I'm struggling to figure out how to use the email.
How would I do this?
At the moment I am using {{ $notification->data['data'] }}
to get the name of the user that makes a comment on another user post.
When a user makes this comment, the posts owner receives a notification that looks like this:
but I need to add the name of the user that commented on the post before the 'commented on your post' text and I need the email to generate the profile picture.
I can use the email if I change the code above to:
'data' => $this->user->email
and I can use the name if I change the code to:
'data' => $this->user->name
but if I use one I cant use the other or at least i don't know how to.
so I'm asking how do I change it so that I can use both the email and name at the same time?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…