Changeset View
Changeset View
Standalone View
Standalone View
src/app/Mail/SignupVerification.php
Show All 35 Lines | class SignupVerification extends Mailable | ||||
* @return $this | * @return $this | ||||
*/ | */ | ||||
public function build() | public function build() | ||||
{ | { | ||||
$href = Utils::serviceUrl( | $href = Utils::serviceUrl( | ||||
sprintf('/signup/%s-%s', $this->code->short_code, $this->code->code) | sprintf('/signup/%s-%s', $this->code->short_code, $this->code->code) | ||||
); | ); | ||||
$username = $this->code->data['first_name'] ?? ''; | $username = $this->code->first_name ?? ''; | ||||
if (!empty($this->code->data['last_name'])) { | if (!empty($this->code->last_name)) { | ||||
$username .= ' ' . $this->code->data['last_name']; | $username .= ' ' . $this->code->last_name; | ||||
} | } | ||||
$username = trim($username); | $username = trim($username); | ||||
$this->view('emails.html.signup_code') | $this->view('emails.html.signup_code') | ||||
->text('emails.plain.signup_code') | ->text('emails.plain.signup_code') | ||||
->subject(__('mail.signupcode-subject', ['site' => \config('app.name')])) | ->subject(__('mail.signupcode-subject', ['site' => \config('app.name')])) | ||||
->with([ | ->with([ | ||||
'site' => \config('app.name'), | 'site' => \config('app.name'), | ||||
Show All 13 Lines | class SignupVerification extends Mailable | ||||
* | * | ||||
* @return string HTML or Plain Text output | * @return string HTML or Plain Text output | ||||
*/ | */ | ||||
public static function fakeRender(string $type = 'html'): string | public static function fakeRender(string $type = 'html'): string | ||||
{ | { | ||||
$code = new SignupCode([ | $code = new SignupCode([ | ||||
'code' => Str::random(SignupCode::CODE_LENGTH), | 'code' => Str::random(SignupCode::CODE_LENGTH), | ||||
'short_code' => SignupCode::generateShortCode(), | 'short_code' => SignupCode::generateShortCode(), | ||||
'data' => [ | |||||
'email' => 'test@' . \config('app.domain'), | 'email' => 'test@' . \config('app.domain'), | ||||
'first_name' => 'Firstname', | 'first_name' => 'Firstname', | ||||
'last_name' => 'Lastname', | 'last_name' => 'Lastname', | ||||
], | |||||
]); | ]); | ||||
$mail = new self($code); | $mail = new self($code); | ||||
return Helper::render($mail, $type); | return Helper::render($mail, $type); | ||||
} | } | ||||
} | } |