feat: email gửi tay/nhắc gia hạn, gói hosting, sửa dữ liệu sản phẩm
- Gửi email theo template cho 1 khách, tab lịch sử email, nhắc gia hạn dịch vụ hàng loạt - Mail lưu from/bcc/sent_by; mẫu MARKETING và mẫu cũ trong TemplateSeeder - Gói hosting: giới hạn, trạng thái, lấy plan Plesk qua CLI gateway - Backfill payment_method và ngày đơn hàng còn thiếu - Bổ sung field CPU/RAM/Disk/Băng thông cho loại sản phẩm vps và cloud Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8651dde6b1
commit
30898ea46f
@@ -15,9 +15,12 @@ class Mail extends Model
|
||||
'campaign_id',
|
||||
'template_id',
|
||||
'subject',
|
||||
'from_address',
|
||||
'to',
|
||||
'cc',
|
||||
'bcc',
|
||||
'customer_id',
|
||||
'sent_by',
|
||||
'message',
|
||||
'status'
|
||||
];
|
||||
@@ -44,6 +47,11 @@ class Mail extends Model
|
||||
return $this->belongsTo(Customer::class, 'customer_id');
|
||||
}
|
||||
|
||||
public function sender()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'sent_by');
|
||||
}
|
||||
|
||||
public function template()
|
||||
{
|
||||
return $this->belongsTo(Template::class, 'template_id');
|
||||
|
||||
@@ -69,7 +69,7 @@ class Order extends Model
|
||||
|
||||
public function payment()
|
||||
{
|
||||
return $this->belongsTo(Payment::class);
|
||||
return $this->belongsTo(Payment::class, 'payment_method', 'id');
|
||||
}
|
||||
|
||||
public function moduleVmwares()
|
||||
|
||||
@@ -8,13 +8,29 @@ class ServicePlan extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'description',
|
||||
'vcpu',
|
||||
'ram',
|
||||
'disk',
|
||||
'domain',
|
||||
'bandwidth',
|
||||
'databases',
|
||||
'mailboxes',
|
||||
'mailbox_quota',
|
||||
'ftp_accounts',
|
||||
'subdomains',
|
||||
'domain_aliases',
|
||||
'features',
|
||||
'is_active',
|
||||
'sort_order',
|
||||
'dns_manager_server_id',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'features' => 'array',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
public function plesk()
|
||||
{
|
||||
return $this->hasOne(ServicePlanPlesk::class);
|
||||
|
||||
@@ -108,14 +108,17 @@ class Template extends Model
|
||||
* 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
|
||||
{
|
||||
return EmailTemplateShell::document($subject, self::layoutBody($contentHtml));
|
||||
}
|
||||
|
||||
public static function layoutBody(string $contentHtml): string
|
||||
{
|
||||
$layout = self::where('scenario', 'layout')->where('status', 1)->first();
|
||||
|
||||
$body = $layout && $layout->message
|
||||
return $layout && $layout->message
|
||||
? str_replace('{{$content}}', $contentHtml, $layout->message)
|
||||
: EmailTemplateShell::wrap(EmailTemplateShell::body($contentHtml));
|
||||
|
||||
return EmailTemplateShell::document($subject, $body);
|
||||
}
|
||||
|
||||
public function type()
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ class User extends Authenticatable implements JWTSubject
|
||||
|
||||
public function getNameAttribute(): string
|
||||
{
|
||||
return trim((string) $this->fullname);
|
||||
return trim("{$this->firstname} {$this->lastname}") ?: trim((string) $this->fullname);
|
||||
}
|
||||
|
||||
public function staffOnline()
|
||||
|
||||
Reference in New Issue
Block a user