|
- <?php
-
- namespace App\Mail\Members;
-
- use App\Models\ResetPassword;
- use App\Models\User;
- use Illuminate\Support\Carbon;
-
- class UserRegisterComplete extends Member
- {
-
-
- private string $email;
-
- private bool $includePasswordReset = false;
- private Carbon|null $expiresAt = null;
- private string $token = "";
-
-
- /**
- * Create a new message instance.
- *
- * @return void
- */
- public function __construct(User $model, ResetPassword|null $password = null)
- {
- $this->email = $model->email;
-
- if ($password !== null) {
- $this->includePasswordReset = true;
- $this->expiresAt = $password->expires_at;
- $this->token = $password->token;
- }
- }
-
- public function getTemplateName(): string
- {
- return 'mails.members.user_register_complete';
- }
-
- public function getSubject(): string
- {
- return '【スマートパーキングパス】会員登録完了';
- }
-
- public function getMemberParams(): array
- {
- return [
- 'email' => $this->email,
- 'includePasswordReset' => $this->includePasswordReset,
- 'url' => $this->getUrl(),
- 'expiresAt' => $this->getExpiresAt(),
- ];
- }
-
- private function getUrl()
- {
- return implode(
- "/",
- [
- config("app.url"),
- 'password-reset',
- $this->token
- ]
- );
- }
-
- private function getExpiresAt()
- {
- if ($this->expiresAt === null) {
- return "";
- } else {
- return $this->expiresAt->format('Y/m/d H:i');
- }
- }
- }
|