feat: Add IT Support catalog and related migrations, seeders, and email templates
- 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.
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductCategories;
|
||||
use App\Models\ProductPricings;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ProductMockupSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$mockups = [
|
||||
'thiet-ke-website' => [
|
||||
'name' => 'Website Landing Page - Cơ bản',
|
||||
'short_description' => 'Thiết kế landing page 1 trang, chuẩn responsive, tối ưu SEO cơ bản.',
|
||||
'setup_fee' => 500000,
|
||||
'features' => null,
|
||||
'price_monthly' => 0,
|
||||
'price_onetime' => 3500000,
|
||||
],
|
||||
'email' => [
|
||||
'name' => 'Email Doanh Nghiệp - Gói 10 tài khoản',
|
||||
'short_description' => 'Email theo tên miền riêng, chống spam, đồng bộ đa thiết bị.',
|
||||
'setup_fee' => 0,
|
||||
'features' => [
|
||||
'mailbox_quota' => 10,
|
||||
'account_count' => 10,
|
||||
'domain' => 'yourcompany.vn',
|
||||
],
|
||||
'price_monthly' => 250000,
|
||||
],
|
||||
'hardware' => [
|
||||
'name' => 'Switch Cisco Catalyst 24-port',
|
||||
'short_description' => 'Switch mạng 24 cổng Gigabit, hàng chính hãng, bảo hành nhà phân phối.',
|
||||
'setup_fee' => 200000,
|
||||
'features' => [
|
||||
'device_type' => 'Switch mạng',
|
||||
'model' => 'Catalyst 2960-24TT-L',
|
||||
'serial_number' => 'SN-CISCO-2960-000123',
|
||||
'warranty_months' => 24,
|
||||
],
|
||||
'price_onetime' => 12500000,
|
||||
],
|
||||
'it-support' => [
|
||||
'name' => 'IT Support - Gói Doanh Nghiệp',
|
||||
'short_description' => 'Hỗ trợ kỹ thuật trọn gói cho văn phòng, ưu tiên xử lý sự cố 24/7.',
|
||||
'setup_fee' => 0,
|
||||
'features' => [
|
||||
'packages' => [
|
||||
['label' => 'Gói Cơ bản', 'value' => '2.000.000đ/tháng - Hỗ trợ giờ hành chính'],
|
||||
['label' => 'Gói Nâng cao', 'value' => '4.500.000đ/tháng - Hỗ trợ 24/7'],
|
||||
['label' => 'Gói Doanh nghiệp', 'value' => '8.000.000đ/tháng - Có kỹ thuật viên thường trực'],
|
||||
],
|
||||
'response_time_hours' => 2,
|
||||
'coverage' => 'Xử lý sự cố phần cứng, phần mềm, mạng nội bộ, sao lưu dữ liệu định kỳ.',
|
||||
],
|
||||
'price_monthly' => 4500000,
|
||||
],
|
||||
'thue-may-chu' => [
|
||||
'name' => 'Thuê Máy Chủ Vật Lý - Dell R740',
|
||||
'short_description' => 'Thuê nguyên máy chủ vật lý đặt tại data center Tier III, băng thông riêng.',
|
||||
'setup_fee' => 1000000,
|
||||
'features' => [
|
||||
'location' => 'Data Center FPT Telecom, Q.9, TP.HCM',
|
||||
'specs' => 'Dell PowerEdge R740, 2x Xeon Silver 4210, 64GB RAM, 2x 960GB SSD RAID1',
|
||||
'rental_months' => 12,
|
||||
],
|
||||
'price_monthly' => 6500000,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($mockups as $categorySlug => $data) {
|
||||
$category = ProductCategories::where('slug', $categorySlug)->first();
|
||||
if (!$category) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$slug = Str::slug($data['name']);
|
||||
if (Product::withTrashed()->where('slug', $slug)->exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$product = Product::create([
|
||||
'name' => $data['name'],
|
||||
'slug' => $slug,
|
||||
'short_description' => $data['short_description'],
|
||||
'product_categories_id' => $category->id,
|
||||
'setup_fee' => $data['setup_fee'],
|
||||
'features' => $data['features'],
|
||||
'is_active' => true,
|
||||
'is_unlimited' => true,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
if (!empty($data['price_monthly'])) {
|
||||
ProductPricings::create([
|
||||
'product_id' => $product->id,
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => $data['price_monthly'],
|
||||
'currency' => 'VND',
|
||||
'is_active' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
if (!empty($data['price_onetime'])) {
|
||||
ProductPricings::create([
|
||||
'product_id' => $product->id,
|
||||
'billing_cycle' => 'onetime',
|
||||
'price' => $data['price_onetime'],
|
||||
'currency' => 'VND',
|
||||
'is_active' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user