Начальный коммит: рабочая версия с исправленной авторизацией

This commit is contained in:
root
2026-01-11 19:15:02 +00:00
commit 2d98209ce1
206 changed files with 20957 additions and 0 deletions

View File

@@ -0,0 +1,326 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class ComponentSeeder extends Seeder
{
public function run()
{
// 1. Удаляем дочерние таблицы СНАЧАЛА
DB::table('components')->delete();
DB::table('ai_tasks')->delete();
// 2. Теперь можно удалить родительскую таблицу
DB::table('component_types')->delete();
// 3. Вставляем типы с фиксированными ID
$componentTypes = [
['id' => 1, 'name' => 'Процессор', 'code' => 'cpu'],
['id' => 2, 'name' => 'Видеокарта', 'code' => 'gpu'],
['id' => 3, 'name' => 'Материнская плата', 'code' => 'motherboard'],
['id' => 4, 'name' => 'ОЗУ', 'code' => 'ram'],
['id' => 5, 'name' => 'Блок питания', 'code' => 'psu'],
['id' => 6, 'name' => 'SSD', 'code' => 'ssd'],
['id' => 7, 'name' => 'Корпус', 'code' => 'case'],
['id' => 8, 'name' => 'Охлаждение', 'code' => 'cooling'],
['id' => 9, 'name' => 'Сеть', 'code' => 'network'],
['id' => 10, 'name' => 'Звуковая карта', 'code' => 'sound']
];
DB::table('component_types')->insert($componentTypes);
// 2. Добавляем 25 официальных компонентов
$components = [
// Процессоры (ID=1)
[
'name' => 'AMD Ryzen 5 5600',
'price' => 15000,
'component_type_id' => 1,
'specifications' => json_encode(['socket' => 'AM4', 'cores' => 6, 'tdp' => 65]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'AMD Ryzen 7 7700X',
'price' => 25000,
'component_type_id' => 1,
'specifications' => json_encode(['socket' => 'AM5', 'cores' => 8, 'tdp' => 105]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'Intel Core i5-13400F',
'price' => 18000,
'component_type_id' => 1,
'specifications' => json_encode(['socket' => 'LGA1700', 'cores' => 10, 'tdp' => 65]),
'is_official' => true,
'created_by_user_id' => null
],
// Видеокарты (ID=2)
[
'name' => 'NVIDIA RTX 4060',
'price' => 30000,
'component_type_id' => 2,
'specifications' => json_encode(['memory_size' => '8GB', 'gpu_clock_speed' => 2445]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'NVIDIA RTX 4070 Ti',
'price' => 45000,
'component_type_id' => 2,
'specifications' => json_encode(['memory_size' => '12GB', 'gpu_clock_speed' => 2610]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'AMD Radeon RX 7800 XT',
'price' => 40000,
'component_type_id' => 2,
'specifications' => json_encode(['memory_size' => '16GB', 'gpu_clock_speed' => 2200]),
'is_official' => true,
'created_by_user_id' => null
],
// Материнские платы (ID=3)
[
'name' => 'ASUS TUF GAMING B660M-PLUS',
'price' => 8000,
'component_type_id' => 3,
'specifications' => json_encode(['chipset' => 'B660', 'form_factor' => 'mATX']),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'MSI B750 TOMAHAWK',
'price' => 12000,
'component_type_id' => 3,
'specifications' => json_encode(['chipset' => 'B750', 'form_factor' => 'ATX']),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'Gigabyte X670E AORUS PRO',
'price' => 15000,
'component_type_id' => 3,
'specifications' => json_encode(['chipset' => 'X670E', 'form_factor' => 'ATX']),
'is_official' => true,
'created_by_user_id' => null
],
// ОЗУ (ID=4)
[
'name' => 'Kingston FURY Beast DDR4 16GB',
'price' => 5000,
'component_type_id' => 4,
'specifications' => json_encode(['type' => 'DDR4', 'capacity' => '16GB', 'speed' => 3200]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'Corsair Vengeance RGB Pro 32GB DDR5-6000',
'price' => 15000,
'component_type_id' => 4,
'specifications' => json_encode(['type' => 'DDR5', 'capacity' => '32GB', 'speed' => 6000]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'G.Skill Trident Z5 32GB DDR5-6000',
'price' => 16000,
'component_type_id' => 4,
'specifications' => json_encode(['type' => 'DDR5', 'capacity' => '32GB', 'speed' => 6000]),
'is_official' => true,
'created_by_user_id' => null
],
// Блоки питания (ID=5)
[
'name' => 'EVGA SuperNOVA 750 G2',
'price' => 8000,
'component_type_id' => 5,
'specifications' => json_encode(['wattage' => 750, 'efficiency' => '80+ Gold']),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'Seasonic FOCUS GX-850',
'price' => 10000,
'component_type_id' => 5,
'specifications' => json_encode(['wattage' => 850, 'efficiency' => '80+ Gold']),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'Corsair RM850x',
'price' => 12000,
'component_type_id' => 5,
'specifications' => json_encode(['wattage' => 850, 'efficiency' => '80+ Gold']),
'is_official' => true,
'created_by_user_id' => null
],
// SSD (ID=6)
[
'name' => 'Samsung 980 PRO 1TB',
'price' => 10000,
'component_type_id' => 6,
'specifications' => json_encode(['interface' => 'NVMe PCIe 4.0 x4', 'capacity' => 1000]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'Crucial P3 500GB NVMe',
'price' => 4000,
'component_type_id' => 6,
'specifications' => json_encode(['interface' => 'NVMe PCIe 3.0 x4', 'capacity' => 500]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'WD Black SN850X 1TB',
'price' => 12000,
'component_type_id' => 6,
'specifications' => json_encode(['interface' => 'NVMe PCIe 4.0 x4', 'capacity' => 1000]),
'is_official' => true,
'created_by_user_id' => null
],
// Корпуса (ID=7)
[
'name' => 'Cooler Master H500P ATX Mid Tower Case',
'price' => 4000,
'component_type_id' => 7,
'specifications' => json_encode(['form_factor' => 'ATX', 'cooling_type' => 'Air']),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'be quiet! Dark Base Pro 9',
'price' => 12000,
'component_type_id' => 7,
'specifications' => json_encode(['form_factor' => 'ATX', 'max_power' => 800]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'Fractal Design Pop Air',
'price' => 5000,
'component_type_id' => 7,
'specifications' => json_encode(['form_factor' => 'ATX', 'cooling_type' => 'Air']),
'is_official' => true,
'created_by_user_id' => null
],
// Охлаждение (ID=8)
[
'name' => 'Noctua NH-D15',
'price' => 7000,
'component_type_id' => 8,
'specifications' => json_encode(['type' => 'Air', 'tdp' => 200]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'Deepcool Assassin III',
'price' => 5000,
'component_type_id' => 8,
'specifications' => json_encode(['type' => 'Air', 'tdp' => 150]),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'AIO Corsair iCUE H150i ELITE CAPELLIX',
'price' => 15000,
'component_type_id' => 8,
'specifications' => json_encode(['type' => 'Liquid', 'radiator_size' => '360mm']),
'is_official' => true,
'created_by_user_id' => null
],
// Сеть (ID=9)
[
'name' => 'TP-Link Archer TX50E',
'price' => 3000,
'component_type_id' => 9,
'specifications' => json_encode(['interface' => 'Wi-Fi 6', 'speed' => '2.5Gbps']),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'Intel I225-V',
'price' => 2000,
'component_type_id' => 9,
'specifications' => json_encode(['interface' => 'Ethernet', 'speed' => '2.5Gbps']),
'is_official' => true,
'created_by_user_id' => null
],
// Звуковые карты (ID=10)
[
'name' => 'Creative Sound Blaster Z',
'price' => 8000,
'component_type_id' => 10,
'specifications' => json_encode(['interface' => 'PCIe', 'sample_rate' => '192kHz']),
'is_official' => true,
'created_by_user_id' => null
],
[
'name' => 'ASUS Xonar SE',
'price' => 5000,
'component_type_id' => 10,
'specifications' => json_encode(['interface' => 'PCIe', 'sample_rate' => '96kHz']),
'is_official' => true,
'created_by_user_id' => null
]
];
foreach ($components as $component) {
DB::table('components')->insert($component);
}
// 3. Добавляем 4 задачи в ai_tasks
// 3. Добавляем 4 задачи в ai_tasks
$aiTasks = [
[
'name' => 'Игровая сборка до 80000 рублей',
'ai_prompt_template' => 'Подобрать оптимальную сборку для игр в 1080p до 80000 рублей.',
'is_active' => true,
'created_at' => now(),
'updated_at' => now()
],
[
'name' => 'Офисная сборка до 30000 рублей',
'ai_prompt_template' => 'Подобрать бюджетную сборку для офисных задач и интернета.',
'is_active' => true,
'created_at' => now(),
'updated_at' => now()
],
[
'name' => 'Рабочая станция для видеомонтажа',
'ai_prompt_template' => 'Подобрать мощную сборку для редактирования 4K видео.',
'is_active' => true,
'created_at' => now(),
'updated_at' => now()
],
[
'name' => 'Игровая сборка до 1500$',
'ai_prompt_template' => 'Подобрать топовую сборку для игр в 4K до 1500$.',
'is_active' => true,
'created_at' => now(),
'updated_at' => now()
]
];
foreach ($aiTasks as $task) {
DB::table('ai_tasks')->insert($task);
}
}
}