I
I
Ivan2021-02-12 18:20:58
Laravel
Ivan, 2021-02-12 18:20:58

For Notification in Laravel there is a method similar to the bcc method for Mail::to?

In the code, email notifications are called something like this: $user->notify(new Message());Can I somehow call a method in it, similar to bcc for emails? Documentation example.

Mail::to($request->user())
    ->bcc($evenMoreUsers)
    ->send(new OrderShipped($order));


Or somehow send a copy of the letter that went to the user to the admin email

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jazzus, 2021-02-13
@Djonson86

$admin->notify(new Message());
after the user or in the notification class add to MailMessage

public function toMail($notifiable)
{
    return (new MailMessage)
        ->cc('[email protected]')
        ->markdown('mail');
}

https://laravel.com/docs/8.x/notifications#mail-no...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question