public function send(MailableInterface $blueprint, User $user) { $this->mailer->send($blueprint->getEmailView(), compact('blueprint', 'user'), function (Message $message) use($blueprint, $user) { $message->to($user->email, $user->username)->subject($blueprint->getEmailSubject()); }); }
/** * Mail a notification to a list of users. * * @param MailableInterface $blueprint * @param User[] $recipients */ protected function mailNotifications(MailableInterface $blueprint, array $recipients) { foreach ($recipients as $user) { if ($user->shouldEmail($blueprint::getType())) { $this->mailer->send($blueprint, $user); } } }