Changeset View
Changeset View
Standalone View
Standalone View
src/app/Mail/TrialEnd.php
- This file was copied from src/app/Mail/SuspendedDebtor.php.
<?php | <?php | ||||
namespace App\Mail; | namespace App\Mail; | ||||
use App\Tenant; | use App\Tenant; | ||||
use App\User; | use App\User; | ||||
use App\Utils; | use App\Utils; | ||||
use Illuminate\Bus\Queueable; | use Illuminate\Bus\Queueable; | ||||
use Illuminate\Mail\Mailable; | use Illuminate\Mail\Mailable; | ||||
use Illuminate\Queue\SerializesModels; | use Illuminate\Queue\SerializesModels; | ||||
class SuspendedDebtor extends Mailable | class TrialEnd extends Mailable | ||||
{ | { | ||||
use Queueable; | use Queueable; | ||||
use SerializesModels; | use SerializesModels; | ||||
/** @var \App\User A suspended user (account) */ | /** @var \App\User An account owner (account) */ | ||||
protected $account; | protected $account; | ||||
/** | /** | ||||
* Create a new message instance. | * Create a new message instance. | ||||
* | * | ||||
* @param \App\User $account A suspended user (account) | * @param \App\User $account An account owner (account) | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function __construct(User $account) | public function __construct(User $account) | ||||
{ | { | ||||
$this->account = $account; | $this->account = $account; | ||||
} | } | ||||
/** | /** | ||||
* Build the message. | * Build the message. | ||||
* | * | ||||
* @return $this | * @return $this | ||||
*/ | */ | ||||
public function build() | public function build() | ||||
{ | { | ||||
$appName = Tenant::getConfig($this->account->tenant_id, 'app.name'); | $appName = Tenant::getConfig($this->account->tenant_id, 'app.name'); | ||||
$paymentUrl = Tenant::getConfig($this->account->tenant_id, 'app.kb.payment_system'); | |||||
$supportUrl = Tenant::getConfig($this->account->tenant_id, 'app.support_url'); | $supportUrl = Tenant::getConfig($this->account->tenant_id, 'app.support_url'); | ||||
$cancelUrl = Tenant::getConfig($this->account->tenant_id, 'app.kb.account_delete'); | |||||
$subject = \trans('mail.suspendeddebtor-subject', ['site' => $appName]); | $subject = \trans('mail.trialend-subject', ['site' => $appName]); | ||||
$moreInfoHtml = null; | $this->view('emails.html.trial_end') | ||||
$moreInfoText = null; | ->text('emails.plain.trial_end') | ||||
if ($moreInfoUrl = Tenant::getConfig($this->account->tenant_id, 'app.kb.account_suspended')) { | |||||
$moreInfoHtml = \trans('mail.more-info-html', ['href' => $moreInfoUrl]); | |||||
$moreInfoText = \trans('mail.more-info-text', ['href' => $moreInfoUrl]); | |||||
} | |||||
$this->view('emails.html.suspended_debtor') | |||||
->text('emails.plain.suspended_debtor') | |||||
->subject($subject) | ->subject($subject) | ||||
->with([ | ->with([ | ||||
'site' => $appName, | 'site' => $appName, | ||||
'subject' => $subject, | 'subject' => $subject, | ||||
'username' => $this->account->name(true), | 'username' => $this->account->name(true), | ||||
'cancelUrl' => $cancelUrl, | 'paymentUrl' => $paymentUrl, | ||||
'supportUrl' => $supportUrl, | 'supportUrl' => Utils::serviceUrl($supportUrl, $this->account->tenant_id), | ||||
'walletUrl' => Utils::serviceUrl('/wallet', $this->account->tenant_id), | |||||
'moreInfoHtml' => $moreInfoHtml, | |||||
'moreInfoText' => $moreInfoText, | |||||
'days' => 14 // TODO: Configurable | |||||
]); | ]); | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | /** | ||||
* Render the mail template with fake data | * Render the mail template with fake data | ||||
* | * | ||||
Show All 13 Lines |