This commit is contained in:
pbao9
2026-02-06 20:52:59 +07:00
parent d7aadf7544
commit e7b9ce7485
17 changed files with 570 additions and 36 deletions
@@ -20,6 +20,8 @@ return new class extends Migration {
$table->string('slug')->unique();
$table->string('short_description')->nullable();
$table->text('description')->nullable();
$table->string('thumbnail')->nullable();
$table->json('gallery')->nullable();
// Trial / stock
$table->integer('stock')->nullable();
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('control_panels', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('slug')->unique();
$table->string('logo')->nullable();
$table->text('description')->nullable();
$table->boolean('is_active')->default(true);
$table->integer('sort_order')->default(0);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('control_panels');
}
};
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('product_control_panel', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('product_id');
$table->unsignedBigInteger('control_panel_id');
$table->decimal('price_modifier', 15, 2)->default(0)->comment('Phụ phí cho control panel này');
$table->boolean('is_default')->default(false)->comment('Panel mặc định cho sản phẩm');
$table->timestamps();
$table->foreign('product_id')
->references('id')
->on('products')
->onDelete('cascade');
$table->foreign('control_panel_id')
->references('id')
->on('control_panels')
->onDelete('cascade');
$table->unique(['product_id', 'control_panel_id']);
});
}
public function down(): void
{
Schema::dropIfExists('product_control_panel');
}
};