Welcome.php 901 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Mail;
  3. use App\User;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Mail\Mailable;
  6. use Illuminate\Queue\SerializesModels;
  7. use Illuminate\Contracts\Queue\ShouldQueue;
  8. class Welcome extends Mailable
  9. {
  10. use Queueable, SerializesModels;
  11. /**
  12. * With Mailable descendents, any public property is available to view().
  13. *
  14. * Or you could pass them manually.
  15. *
  16. * @var User
  17. *
  18. * @see Mailable::buildViewData()
  19. */
  20. public $user;
  21. /**
  22. * Create a new message instance.
  23. */
  24. public function __construct(User $user)
  25. {
  26. $this->user = $user;
  27. }
  28. /**
  29. * Build the message.
  30. *
  31. * @return $this
  32. */
  33. public function build()
  34. {
  35. return $this->view('emails.welcome')
  36. // Not needed because $this->user is public.
  37. // ->with(['user' => $this->user])
  38. ;
  39. }
  40. }