Files
portal-api/app/Models/ServicePlan.php
T
baodev0andClaude Opus 5.5 c5115b52dd feat: nạp tiền thủ công mã 30 phút, gia hạn trừ số dư, đồng bộ domain từ Plesk
- Nạp tiền: mã thanh toán sống 30 phút (ManualDepositDraft), khôi phục/huỷ mã, lệnh dọn mã hết hạn; total_pending chỉ tính giao dịch đã nộp chứng từ, admin duyệt/từ chối/xoá giao dịch
- Gia hạn dịch vụ: phát hành invoice gia hạn trên order gốc và trừ số dư ngay
- Đồng bộ domain từ Plesk theo server, ServiceOrderRecorder tạo order/invoice cho dịch vụ admin dựng
- Danh sách dịch vụ trả field theo loại (service_plan, dns_records_count), đếm dịch vụ theo loại

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 23:07:51 +07:00

61 lines
1.4 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
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);
}
public function dnsServer()
{
return $this->belongsTo(DnsServer::class, 'dns_manager_server_id');
}
public function summary(): array
{
return [
'title' => $this->title,
'vcpu' => $this->vcpu,
'ram' => $this->ram,
'disk' => $this->disk,
'bandwidth' => $this->bandwidth,
'databases' => $this->databases,
'mailboxes' => $this->mailboxes,
'ftp_accounts' => $this->ftp_accounts,
'subdomains' => $this->subdomains,
'domain_aliases' => $this->domain_aliases,
'features' => $this->features ?? [],
];
}
}