NoticeMail.php 670 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Mail;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Mail\Mailable;
  5. use Illuminate\Queue\SerializesModels;
  6. class NoticeMail extends Mailable
  7. {
  8. use Queueable, SerializesModels;
  9. protected $body = [];
  10. protected $title = [];
  11. /**
  12. * 创建一个新消息实例。
  13. *
  14. * @return void
  15. */
  16. public function __construct($title, $body)
  17. {
  18. $this->title = $title;
  19. $this->body = $body;
  20. }
  21. /**
  22. * 构建消息。
  23. *
  24. * @return $this
  25. */
  26. public function build()
  27. {
  28. return $this->view('emails.information')->subject($this->title)->with(['body' => $this->body]);
  29. }
  30. }