Changeset View
Changeset View
Standalone View
Standalone View
src/app/Mail/PaymentSuccess.php
Show All 40 Lines | class PaymentSuccess extends Mailable | ||||
* @return $this | * @return $this | ||||
*/ | */ | ||||
public function build() | public function build() | ||||
{ | { | ||||
$user = $this->user; | $user = $this->user; | ||||
$subject = \trans('mail.paymentsuccess-subject', ['site' => \config('app.name')]); | $subject = \trans('mail.paymentsuccess-subject', ['site' => \config('app.name')]); | ||||
$this->view('emails.payment_success') | $this->view('emails.html.payment_success') | ||||
->text('emails.plain.payment_success') | |||||
->subject($subject) | ->subject($subject) | ||||
->with([ | ->with([ | ||||
'site' => \config('app.name'), | 'site' => \config('app.name'), | ||||
'subject' => $subject, | 'subject' => $subject, | ||||
'username' => $user->name(true), | 'username' => $user->name(true), | ||||
'walletUrl' => Utils::serviceUrl('/wallet'), | 'walletUrl' => Utils::serviceUrl('/wallet'), | ||||
'supportUrl' => \config('app.support_url'), | 'supportUrl' => \config('app.support_url'), | ||||
]); | ]); | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | /** | ||||
* Render the mail template with fake data | * Render the mail template with fake data | ||||
* | * | ||||
* @return string HTML output | * @param string $type Output format ('html' or 'text') | ||||
* | |||||
* @return string HTML or Plain Text output | |||||
*/ | */ | ||||
public static function fakeRender(): string | public static function fakeRender(string $type = 'html'): string | ||||
{ | { | ||||
$payment = new Payment(); | $payment = new Payment(); | ||||
$user = new User([ | $user = new User([ | ||||
'email' => 'test@' . \config('app.domain'), | 'email' => 'test@' . \config('app.domain'), | ||||
]); | ]); | ||||
if (!\config('app.support_url')) { | |||||
\config(['app.support_url' => 'https://not-configured-support.url']); | |||||
} | |||||
$mail = new self($payment, $user); | $mail = new self($payment, $user); | ||||
return $mail->build()->render(); | return Helper::render($mail, $type); | ||||
} | } | ||||
} | } |