領収証発行サービス
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.2KB

  1. <?php
  2. namespace App\Mail\Guests;
  3. use App\Models\ChangeEmail;
  4. use Exception;
  5. use Illuminate\Support\Carbon;
  6. class ChangeEmailStart extends Guest
  7. {
  8. protected string $token;
  9. protected Carbon $expiresAt;
  10. protected $casts = [
  11. 'expiresAt' => 'datetime',
  12. ];
  13. /**
  14. * Create a new message instance.
  15. *
  16. * @return void
  17. */
  18. public function __construct(ChangeEmail $model)
  19. {
  20. logger($model->toArray());
  21. $this->setValues($model->toArray());
  22. }
  23. public function getTemplateName(): string
  24. {
  25. return 'mails.guests.change_email_start';
  26. }
  27. public function getSubject(): string
  28. {
  29. return '【スマートパーキングパス】Email変更手続きのご案内';
  30. }
  31. public function getGuestParams(): array
  32. {
  33. return [
  34. 'url' => $this->getUrl(),
  35. 'expiresAt' => $this->getExpiresAt(),
  36. ];
  37. }
  38. private function getUrl()
  39. {
  40. return implode(
  41. "/",
  42. [
  43. config("app.url"),
  44. 'change-email',
  45. $this->token
  46. ]
  47. );
  48. }
  49. private function getExpiresAt()
  50. {
  51. return $this->expiresAt->format('Y/m/d H:i');
  52. }
  53. }