Начальный коммит: рабочая версия с исправленной авторизацией
This commit is contained in:
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
48
database/factories/UserFactory.php
Normal file
48
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
<<<<<<< HEAD
|
||||
'custom_field' => 'user',
|
||||
=======
|
||||
>>>>>>> origin/main
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
56
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
56
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
<<<<<<< HEAD
|
||||
$table->string('custom_field')->default('user'); // ← по умолчанию обычный пользователь
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
|
||||
=======
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
>>>>>>> origin/main
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name'); // Например: "Процессор", "Видеокарта"
|
||||
$table->string('code')->unique(); // Уникальный код: cpu, gpu, ram и т.д.
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// Заполняем таблицу начальными данными (seed)
|
||||
DB::table('component_types')->insert([
|
||||
['name' => 'Процессор', 'code' => 'cpu'],
|
||||
['name' => 'Видеокарта', 'code' => 'gpu'],
|
||||
['name' => 'Материнская плата', 'code' => 'motherboard'],
|
||||
['name' => 'ОЗУ', 'code' => 'ram'],
|
||||
['name' => 'Блок питания', 'code' => 'psu'],
|
||||
['name' => 'SSD', 'code' => 'ssd'],
|
||||
['name' => 'Корпус', 'code' => 'case'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('component_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('components', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->decimal('price', 10, 2);
|
||||
$table->unsignedBigInteger('component_type_id'); // ссылка на тип компонента
|
||||
$table->json('specifications')->nullable(); // JSON-поле для характеристик
|
||||
$table->boolean('is_official')->default(false); // официальный или нет
|
||||
$table->unsignedBigInteger('created_by_user_id')->nullable(); // кто создал
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('component_type_id')->references('id')->on('component_types');
|
||||
$table->foreign('created_by_user_id')->references('id')->on('users')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('components');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->text('custom_field')->nullable()->default(null);
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('custom_field');
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->text('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable()->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('component_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name'); // Например: "Процессор", "Видеокарта"
|
||||
$table->string('code')->unique(); // Уникальный код: cpu, gpu, ram и т.д.
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// Заполняем таблицу начальными данными (seed)
|
||||
DB::table('component_types')->insert([
|
||||
['name' => 'Процессор', 'code' => 'cpu'],
|
||||
['name' => 'Видеокарта', 'code' => 'gpu'],
|
||||
['name' => 'Материнская плата', 'code' => 'motherboard'],
|
||||
['name' => 'ОЗУ', 'code' => 'ram'],
|
||||
['name' => 'Блок питания', 'code' => 'psu'],
|
||||
['name' => 'SSD', 'code' => 'ssd'],
|
||||
['name' => 'Корпус', 'code' => 'case'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('component_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePcBuildsTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pc_builds', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->string('name'); // Например: "Игровой ПК 2025"
|
||||
$table->text('description')->nullable(); // Описание
|
||||
$table->boolean('is_ai_generated')->default(false); // true = сгенерировано ИИ
|
||||
$table->text('ai_prompt')->nullable(); // Исходный запрос к ИИ
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pc_builds');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePcBuildComponentsTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pc_build_components', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('pc_build_id');
|
||||
$table->unsignedBigInteger('component_id');
|
||||
$table->timestamps();
|
||||
|
||||
// Внешние ключи
|
||||
$table->foreign('pc_build_id')->references('id')->on('pc_builds')->onDelete('cascade');
|
||||
$table->foreign('component_id')->references('id')->on('components')->onDelete('cascade');
|
||||
|
||||
// Уникальность пары (build + component), если нужно
|
||||
$table->unique(['pc_build_id', 'component_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pc_build_components');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
<<<<<<< HEAD
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ai_tasks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name'); // ← БЫЛО 'title', СТАЛО 'name'
|
||||
$table->text('description')->nullable();
|
||||
$table->text('ai_prompt_template');
|
||||
$table->decimal('budget_min', 10, 2)->nullable();
|
||||
$table->decimal('budget_max', 10, 2)->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ai_tasks');
|
||||
}
|
||||
};
|
||||
=======
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
{
|
||||
Schema::create('ai_tasks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->onDelete('set null');
|
||||
$table->string('name');
|
||||
$table->text('prompt_template');
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
// Индекс для поиска активных шаблонов
|
||||
$table->index(['is_active']);
|
||||
});
|
||||
|
||||
// Заполняем базовыми шаблонами от админа (user_id = NULL)
|
||||
DB::table('ai_tasks')->insert([
|
||||
[
|
||||
'name' => 'Игровой ПК до 50 000 ₽',
|
||||
'prompt_template' => 'Собери бюджетный игровой ПК до 50000 рублей. Цель: игры на средних настройках в 1080p.',
|
||||
'is_active' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'name' => 'Игровой ПК до 100 000 ₽',
|
||||
'prompt_template' => 'Собери мощный игровой ПК до 100000 рублей. Цель: игры на ультра в 1440p, 60+ FPS.',
|
||||
'is_active' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'name' => 'Офисный ПК',
|
||||
'prompt_template' => 'Собери надёжный ПК для офиса и учёбы. Бюджет до 40000 рублей. Важна тишина и энергоэффективность.',
|
||||
'is_active' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ai_tasks');
|
||||
}
|
||||
};
|
||||
>>>>>>> origin/main
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->text('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable()->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->text('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable()->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
||||
326
database/seeders/ComponentSeeder.php
Normal file
326
database/seeders/ComponentSeeder.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
32
database/seeders/DatabaseSeeder.php
Normal file
32
database/seeders/DatabaseSeeder.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
use WithoutModelEvents;
|
||||
>>>>>>> origin/main
|
||||
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
$this->call(ComponentSeeder::class);
|
||||
=======
|
||||
>>>>>>> origin/main
|
||||
// User::factory(10)->create();
|
||||
|
||||
User::factory()->create([
|
||||
'name' => 'Test User',
|
||||
'email' => 'test@example.com',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user