update
This commit is contained in:
+12
-15
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Support\EmailTemplateShell;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
@@ -81,7 +82,6 @@ class Template extends Model
|
||||
'vm_creation_failed' => 'Khởi tạo VPS thất bại',
|
||||
'vm_password_changed' => 'Đổi mật khẩu VPS',
|
||||
'vm_rebuild_failed' => 'Rebuild VPS thất bại',
|
||||
'holiday_notice' => 'Thông báo nghỉ lễ',
|
||||
'domain_order_approved' => 'Tên miền được duyệt',
|
||||
'domain_order_rejected' => 'Tên miền bị từ chối',
|
||||
'order_created' => 'Xác nhận đơn hàng',
|
||||
@@ -98,8 +98,11 @@ class Template extends Model
|
||||
'customer_signup_verify' => 'Xác thực đăng ký tài khoản',
|
||||
'hosting_information' => 'Thông tin truy cập Hosting',
|
||||
'customer_password_reset' => 'Khôi phục mật khẩu khách hàng',
|
||||
'customer_password_reset_link' => 'Link đặt lại mật khẩu khách hàng',
|
||||
'service_expiry' => 'Dịch vụ sắp hết hạn',
|
||||
'customer_payment' => 'Thông báo thanh toán khách hàng',
|
||||
'invoice_payment_reminder' => 'Nhắc thanh toán hoá đơn',
|
||||
'invoice_notification' => 'Thông báo hoá đơn / gia hạn cước',
|
||||
];
|
||||
|
||||
public function invoiceTemplate()
|
||||
@@ -109,26 +112,20 @@ class Template extends Model
|
||||
|
||||
/**
|
||||
* Wrap $contentHtml with the admin-editable "layout" template (scenario=layout),
|
||||
* replacing its {{$content}} placeholder. Falls back to the static blade
|
||||
* template-camp wrapper when no active layout template is configured.
|
||||
* replacing its {{$content}} placeholder.
|
||||
*
|
||||
* Không còn fallback về blade: mọi email đều render từ tbl.template. Thiếu layout thì
|
||||
* dùng khung header/footer chuẩn trong code thay vì gửi ra nội dung trần.
|
||||
*/
|
||||
public static function renderWithLayout(?string $subject, string $contentHtml): string
|
||||
{
|
||||
$layout = self::where('scenario', 'layout')->where('status', 1)->first();
|
||||
|
||||
if (!$layout || !$layout->message) {
|
||||
return view('emails.customer.template-camp', [
|
||||
'content' => $contentHtml,
|
||||
'emailSubject' => $subject,
|
||||
])->render();
|
||||
}
|
||||
$body = $layout && $layout->message
|
||||
? str_replace('{{$content}}', $contentHtml, $layout->message)
|
||||
: EmailTemplateShell::wrap(EmailTemplateShell::body($contentHtml));
|
||||
|
||||
$body = str_replace('{{$content}}', $contentHtml, $layout->message);
|
||||
|
||||
return view('emails.customer.template-envelope', [
|
||||
'body' => $body,
|
||||
'emailSubject' => $subject,
|
||||
])->render();
|
||||
return EmailTemplateShell::document($subject, $body);
|
||||
}
|
||||
|
||||
public function type()
|
||||
|
||||
Reference in New Issue
Block a user