dev update
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Template;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Seed the default "layout" template (scenario=layout) used by
|
||||
* Template::renderWithLayout() to wrap mail-campaign / manual emails with
|
||||
* the fixed TGS header + footer. Editable afterwards from
|
||||
* Settings > Email Template like any other template.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (Template::where('scenario', 'layout')->exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Template::create([
|
||||
'type_id' => 0,
|
||||
'name' => 'Bố cục Header/Footer mặc định',
|
||||
'scenario' => 'layout',
|
||||
'format' => 'html',
|
||||
'subject' => null,
|
||||
'status' => 1,
|
||||
'message' => $this->layoutHtml(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Template::where('scenario', 'layout')->delete();
|
||||
}
|
||||
|
||||
private function layoutHtml(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<table style="border-collapse: collapse; width: 100%; background-color: #efefef;" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 20px;" align="center" valign="top">
|
||||
<table style="padding-top: 20px; padding-bottom: 20px; border-collapse: collapse; background-color: #ffffff; width: 700px;" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr class="Header">
|
||||
<td style="width: 700px;" valign="top">
|
||||
<table align="center" width="700" bgcolor="#ffffff" style="border-collapse: collapse; width: 700px; max-width: 100%; text-align: center; background-color: #ffffff; border-top: 5px solid #f16723;" border="0" cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 0;">
|
||||
<a href="https://tgs.com.vn" style="display: block;" target="_blank" rel="noopener">
|
||||
<img src="https://res.cloudinary.com/izpast9i/image/upload/v1786499308/email_header.png" alt="Thư gửi từ Công Ty Cổ Phần Giải Pháp Công Nghệ Thế Giới Số" style="width: 100%; display: block; border: none;" width="700">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="NoiDungKM">
|
||||
<td style="width: 700px; padding: 25px; background-color: #ffffff;" valign="top">
|
||||
{{$content}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="Footer">
|
||||
<td align="center" valign="top">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="700" align="center" background="https://res.cloudinary.com/izpast9i/image/upload/v1786500298/email_footer.png" bgcolor="#F16723" style="border-collapse: collapse; width: 700px; background-image: url("https://res.cloudinary.com/izpast9i/image/upload/v1786500298/email_footer.png"); background-size: cover; background-position: center; background-repeat: no-repeat;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 40px 30px 20px 30px; text-align: center;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: separate; border-spacing: 8px 0; width: 100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
|
||||
<a href="https://tgs.com.vn/premium-hosting/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Premium Hosting</a>
|
||||
</td>
|
||||
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
|
||||
<a href="https://tgs.com.vn/cloud-server/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Cloud Server</a>
|
||||
</td>
|
||||
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
|
||||
<a href="https://cloudemail.vn/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Email doanh nghiệp</a>
|
||||
</td>
|
||||
<td width="25%" style="border: 1px solid rgba(255,255,255,0.35); border-radius: 8px; padding: 6px 4px; font-size: 12px; line-height: 16px; color: #ffffff; text-align: center; background-color: rgba(255,255,255,0.18); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);">
|
||||
<a href="https://tgs.com.vn/thiet-ke-website/" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: none;">Thiết kế website</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 6px 30px 0 30px; text-align: center;">
|
||||
<strong style="font-size: 14px; line-height: 22px; color: #ffffff;">CÔNG TY CỔ PHẦN GIẢI PHÁP CÔNG NGHỆ THẾ GIỚI SỐ</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 6px 30px 0 30px; text-align: center;">
|
||||
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Địa chỉ: 128/38 Tân Hương, Phường Phú Thọ Hòa, Thành Phố Hồ Chí Minh</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 6px 30px 0 30px; text-align: center;">
|
||||
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Tel: (028) 7309.7379 - MST: 0318443116</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 6px 30px 0 30px; text-align: center;">
|
||||
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">Email: <a href="mailto:support@tgs.com.vn" style="color: #ffffff; text-decoration: none;">support@tgs.com.vn</a></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 6px 30px 0 30px; text-align: center;">
|
||||
<span style="font-size: 12px; line-height: 18px; color: #ffffff;">
|
||||
<a href="https://www.tgs.com.vn" style="color: #ffffff; text-decoration: underline;">www.TGS.com.vn</a>
|
||||
&
|
||||
<a href="https://www.thegioiso.cloud" style="color: #ffffff; text-decoration: underline;">www.thegioiso.CLOUD</a>
|
||||
&
|
||||
<a href="https://www.thegioiserver.com" style="color: #ffffff; text-decoration: underline;">www.thegioiSERVER.com</a>
|
||||
&
|
||||
<a href="https://www.cloudemail.vn" style="color: #ffffff; text-decoration: underline;">www.CloudEmail.vn</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 6px 30px 16px 30px; text-align: center;">
|
||||
<span style="font-size: 12px; line-height: 20px; color: #ffffff; font-weight: bold;">Thế Giới Số- Premium HOSTING • CLOUD • SERVER & WEBSITE | 15+ năm Phụng Sự</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
HTML;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('template', function (Blueprint $table) {
|
||||
// key: định danh duy nhất để hệ thống tra cứu + gửi email theo key này,
|
||||
// độc lập với scenario (scenario chỉ để phân loại/hiển thị).
|
||||
$table->string('key', 100)->nullable()->unique()->after('scenario')
|
||||
->comment('Định danh duy nhất dùng để tra template khi gửi mail (EmailTemplateService::loadTemplate)');
|
||||
});
|
||||
|
||||
// Backfill: mặc định key = scenario cho các template đã có scenario,
|
||||
// để mọi lời gọi gửi email theo scenario hiện tại tiếp tục hoạt động.
|
||||
DB::table('template')
|
||||
->whereNotNull('scenario')
|
||||
->orderBy('id')
|
||||
->get(['id', 'scenario'])
|
||||
->each(fn ($row) => DB::table('template')->where('id', $row->id)->update(['key' => $row->scenario]));
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('template', function (Blueprint $table) {
|
||||
$table->dropColumn('key');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user