- Created migration to add 'group_label' to 'product_type_fields' table. - Implemented ItSupportCatalogSeeder to populate IT Support features and tiers. - Added ProductCategorySeeder for initial product categories. - Developed ProductMockupSeeder for mockup products in various categories. - Introduced ProductTypeFieldSeeder to define fields for different product types. - Created email templates for VPS service information and service renewal reminders.
228 lines
11 KiB
PHP
228 lines
11 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Product;
|
|
use App\Models\ProductCategories;
|
|
use App\Models\ProductPricings;
|
|
use App\Models\ProductTypeField;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Str;
|
|
|
|
class ItSupportCatalogSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Real IT Support comparison matrix (4 tiers x N feature rows), replaces
|
|
* the earlier generic "packages" mockup field with the actual per-tier
|
|
* feature grid the business sells.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
// Fields no longer used by the real matrix (superseded by the rows below).
|
|
ProductTypeField::where('product_type', 'it_support')
|
|
->whereIn('key', ['packages', 'response_time_hours', 'coverage'])
|
|
->delete();
|
|
|
|
$groups = [
|
|
'Nhóm dịch vụ phần mềm & thiết bị' => [
|
|
['device_check_frequency', 'Kiểm tra thiết bị định kỳ', 'text'],
|
|
['device_cleaning_frequency', 'Vệ sinh thiết bị định kỳ', 'text'],
|
|
['software_install_on_request', 'Cài đặt phần mềm theo yêu cầu', 'text'],
|
|
['virus_scan_frequency', 'Kiểm tra và quét virus định kỳ', 'text'],
|
|
['hw_sw_troubleshooting', 'Xử lý các lỗi phần cứng, phần mềm', 'text'],
|
|
['loaner_device', 'Cho mượn thiết bị thay thế khi cần', 'text'],
|
|
],
|
|
'Nhóm hạ tầng & hỗ trợ kỹ thuật' => [
|
|
['operations_staff', 'Nhân sự vận hành hệ thống', 'text'],
|
|
['response_time', 'Thời gian tiếp nhận và hỗ trợ', 'text'],
|
|
['support_channels', 'Kênh hỗ trợ', 'text'],
|
|
['monitoring_24_7', 'Hệ thống giám sát hạ tầng 24/7', 'text'],
|
|
['infra_report_frequency', 'Báo cáo hệ thống hạ tầng', 'text'],
|
|
['backup_restore', 'Hệ thống Backup - Restore Data', 'text'],
|
|
],
|
|
'Camera/IP Phone & thiết bị ngoại vi' => [
|
|
['camera_ip_phone_support', 'Hỗ trợ kiểm tra thiết bị (Camera/IP Phone)', 'text'],
|
|
],
|
|
'Tư vấn & bảo mật' => [
|
|
['upgrade_consulting', 'Tư vấn & báo giá nâng cấp thiết bị văn phòng', 'text'],
|
|
['security_alert_notice', 'Thông báo lỗ hổng bảo mật đến người dùng', 'text'],
|
|
['issue_consulting', 'Tư vấn lỗi thường gặp và đề xuất hướng xử lý', 'text'],
|
|
],
|
|
'Tường lửa & bảo vệ truy cập' => [
|
|
['firewall_support_level', 'Hỗ trợ và xử lý yêu cầu tường lửa', 'text'],
|
|
['website_download_block', 'Chặn truy cập website, tải xuống theo yêu cầu', 'text'],
|
|
['network_security_incident', 'Xử lý sự cố kết nối mạng & bảo mật', 'text'],
|
|
['remote_access_setup', 'Thiết lập truy xuất dữ liệu từ xa', 'text'],
|
|
],
|
|
];
|
|
|
|
$sortOrder = 0;
|
|
foreach ($groups as $groupLabel => $rows) {
|
|
foreach ($rows as [$key, $label, $fieldType]) {
|
|
$sortOrder++;
|
|
ProductTypeField::updateOrCreate(
|
|
['product_type' => 'it_support', 'key' => $key],
|
|
[
|
|
'group_label' => $groupLabel,
|
|
'label' => $label,
|
|
'field_type' => $fieldType,
|
|
'sort_order' => $sortOrder,
|
|
'is_required' => false,
|
|
]
|
|
);
|
|
}
|
|
}
|
|
|
|
// ── 4 tiers (Star / Silver / Gold / Diamond) ──────────────────────
|
|
$category = ProductCategories::where('slug', 'it-support')->first();
|
|
if (!$category) {
|
|
return;
|
|
}
|
|
|
|
$tiers = [
|
|
[
|
|
'name' => 'IT Helpdesk Star',
|
|
'short_description' => 'Dưới 10 PC — 200.000đ / máy / tháng',
|
|
'price_monthly' => 200000,
|
|
'values' => [
|
|
'device_check_frequency' => '2 tháng/lần',
|
|
'device_cleaning_frequency' => '2 tháng/lần',
|
|
'software_install_on_request' => 'Có',
|
|
'virus_scan_frequency' => '3 tháng/lần',
|
|
'hw_sw_troubleshooting' => 'Có',
|
|
'loaner_device' => 'Có',
|
|
'operations_staff' => '1 IT Manager · 5 IT Hỗ trợ',
|
|
'response_time' => "Online 15' · Onsite 120'",
|
|
'support_channels' => 'Phone, Chat, Webform, Email',
|
|
'monitoring_24_7' => 'Có',
|
|
'infra_report_frequency' => 'Hàng tháng',
|
|
'backup_restore' => 'Có',
|
|
'camera_ip_phone_support' => 'Có',
|
|
'upgrade_consulting' => 'Có',
|
|
'security_alert_notice' => 'Có',
|
|
'issue_consulting' => 'Có',
|
|
'firewall_support_level' => 'Cơ bản',
|
|
'website_download_block' => 'Có',
|
|
'network_security_incident' => 'Có',
|
|
'remote_access_setup' => 'Có',
|
|
],
|
|
],
|
|
[
|
|
'name' => 'IT Helpdesk Silver',
|
|
'short_description' => '10 - 30 PC — 180.000đ / máy / tháng',
|
|
'price_monthly' => 180000,
|
|
'values' => [
|
|
'device_check_frequency' => '1 tháng/lần',
|
|
'device_cleaning_frequency' => '2 tháng/lần',
|
|
'software_install_on_request' => 'Có',
|
|
'virus_scan_frequency' => '2 tháng/lần',
|
|
'hw_sw_troubleshooting' => 'Có',
|
|
'loaner_device' => 'Có',
|
|
'operations_staff' => '1 IT Manager · 5 IT Hỗ trợ',
|
|
'response_time' => "Online 10' · Onsite 90'",
|
|
'support_channels' => 'Phone, Chat, Webform, Email',
|
|
'monitoring_24_7' => 'Có',
|
|
'infra_report_frequency' => 'Hàng tuần, tháng',
|
|
'backup_restore' => 'Có',
|
|
'camera_ip_phone_support' => 'Có',
|
|
'upgrade_consulting' => 'Có',
|
|
'security_alert_notice' => 'Có',
|
|
'issue_consulting' => 'Có',
|
|
'firewall_support_level' => 'Tiêu chuẩn',
|
|
'website_download_block' => 'Có',
|
|
'network_security_incident' => 'Có',
|
|
'remote_access_setup' => 'Có',
|
|
],
|
|
],
|
|
[
|
|
'name' => 'IT Helpdesk Gold',
|
|
'short_description' => '31 - 49 PC — 150.000đ / máy / tháng',
|
|
'price_monthly' => 150000,
|
|
'values' => [
|
|
'device_check_frequency' => '1 tháng/lần',
|
|
'device_cleaning_frequency' => '1 tháng/lần',
|
|
'software_install_on_request' => 'Có',
|
|
'virus_scan_frequency' => '1 tháng/lần',
|
|
'hw_sw_troubleshooting' => 'Có',
|
|
'loaner_device' => 'Có',
|
|
'operations_staff' => '1 IT Manager · 5 IT Hỗ trợ',
|
|
'response_time' => "Online 10' · Onsite 60'",
|
|
'support_channels' => 'Phone, Chat, Webform, Email',
|
|
'monitoring_24_7' => 'Có',
|
|
'infra_report_frequency' => 'Hàng tuần, tháng',
|
|
'backup_restore' => 'Có',
|
|
'camera_ip_phone_support' => 'Có',
|
|
'upgrade_consulting' => 'Có',
|
|
'security_alert_notice' => 'Có',
|
|
'issue_consulting' => 'Có',
|
|
'firewall_support_level' => 'Nâng cao',
|
|
'website_download_block' => 'Có',
|
|
'network_security_incident' => 'Có',
|
|
'remote_access_setup' => 'Có',
|
|
],
|
|
],
|
|
[
|
|
'name' => 'IT Helpdesk Diamond',
|
|
'short_description' => 'Kinh doanh đặc biệt — Liên hệ báo giá',
|
|
'price_monthly' => null,
|
|
'values' => [
|
|
'device_check_frequency' => '1 tháng/lần',
|
|
'device_cleaning_frequency' => '1 tháng/lần',
|
|
'software_install_on_request' => 'Có',
|
|
'virus_scan_frequency' => '1 tháng/lần',
|
|
'hw_sw_troubleshooting' => 'Có',
|
|
'loaner_device' => 'Có',
|
|
'operations_staff' => '1 IT Manager · 5 IT Hỗ trợ',
|
|
'response_time' => "Online 10' · Onsite 60'",
|
|
'support_channels' => 'Phone, Chat, Webform, Email',
|
|
'monitoring_24_7' => 'Có',
|
|
'infra_report_frequency' => 'Hàng tuần, tháng',
|
|
'backup_restore' => 'Có',
|
|
'camera_ip_phone_support' => 'Có',
|
|
'upgrade_consulting' => 'Có',
|
|
'security_alert_notice' => 'Có',
|
|
'issue_consulting' => 'Có',
|
|
'firewall_support_level' => 'Cao cấp',
|
|
'website_download_block' => 'Có',
|
|
'network_security_incident' => 'Có',
|
|
'remote_access_setup' => 'Có',
|
|
],
|
|
],
|
|
];
|
|
|
|
// Remove the earlier single generic mockup — superseded by the 4 real tiers.
|
|
Product::withTrashed()->where('slug', 'it-support-goi-doanh-nghiep')->first()?->forceDelete();
|
|
|
|
foreach ($tiers as $tier) {
|
|
$slug = Str::slug($tier['name']);
|
|
$product = Product::withTrashed()->where('slug', $slug)->first();
|
|
|
|
if (!$product) {
|
|
$product = Product::create([
|
|
'name' => $tier['name'],
|
|
'slug' => $slug,
|
|
'short_description' => $tier['short_description'],
|
|
'product_categories_id' => $category->id,
|
|
'setup_fee' => 0,
|
|
'features' => $tier['values'],
|
|
'is_active' => true,
|
|
'is_unlimited' => true,
|
|
'published_at' => now(),
|
|
]);
|
|
} else {
|
|
$product->update([
|
|
'short_description' => $tier['short_description'],
|
|
'features' => $tier['values'],
|
|
]);
|
|
}
|
|
|
|
if ($tier['price_monthly'] !== null) {
|
|
ProductPricings::updateOrCreate(
|
|
['product_id' => $product->id, 'billing_cycle' => 'monthly'],
|
|
['price' => $tier['price_monthly'], 'currency' => 'VND', 'is_active' => true]
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|