Flarum\Core\Notification\NotificationMailer::send PHP Метод

send() публичный Метод

public send ( Flarum\Core\Notification\MailableInterface $blueprint, User $user )
$blueprint Flarum\Core\Notification\MailableInterface
$user Flarum\Core\User
    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());
        });
    }

Usage Example

Пример #1
0
 /**
  * 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);
         }
     }
 }
NotificationMailer