updat
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\ControlPanel;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ControlPanelSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$panels = [
|
||||
[
|
||||
'name' => 'Plesk Panel',
|
||||
'slug' => 'plesk',
|
||||
'logo' => '/images/control-panels/plesk.png',
|
||||
'description' => 'Plesk là control panel thương mại hàng đầu với giao diện thân thiện, hỗ trợ cả Windows và Linux.',
|
||||
'is_active' => true,
|
||||
'sort_order' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'DirectAdmin',
|
||||
'slug' => 'directadmin',
|
||||
'logo' => '/images/control-panels/directadmin.png',
|
||||
'description' => 'DirectAdmin là control panel nhẹ, nhanh và ổn định, phù hợp cho các server có cấu hình thấp.',
|
||||
'is_active' => true,
|
||||
'sort_order' => 2,
|
||||
],
|
||||
[
|
||||
'name' => 'aaPanel',
|
||||
'slug' => 'aapanel',
|
||||
'logo' => '/images/control-panels/aapanel.png',
|
||||
'description' => 'aaPanel là control panel miễn phí với giao diện đơn giản, dễ sử dụng, hỗ trợ LNMP/LAMP.',
|
||||
'is_active' => true,
|
||||
'sort_order' => 3,
|
||||
],
|
||||
[
|
||||
'name' => 'cPanel',
|
||||
'slug' => 'cpanel',
|
||||
'logo' => '/images/control-panels/cpanel.png',
|
||||
'description' => 'cPanel là control panel phổ biến nhất thế giới với đầy đủ tính năng quản lý hosting.',
|
||||
'is_active' => true,
|
||||
'sort_order' => 4,
|
||||
],
|
||||
[
|
||||
'name' => 'CyberPanel',
|
||||
'slug' => 'cyberpanel',
|
||||
'logo' => '/images/control-panels/cyberpanel.png',
|
||||
'description' => 'CyberPanel là control panel miễn phí sử dụng OpenLiteSpeed, tối ưu hiệu suất website.',
|
||||
'is_active' => true,
|
||||
'sort_order' => 5,
|
||||
],
|
||||
[
|
||||
'name' => 'HestiaCP',
|
||||
'slug' => 'hestiacp',
|
||||
'logo' => '/images/control-panels/hestiacp.png',
|
||||
'description' => 'HestiaCP là control panel mã nguồn mở, nhẹ và miễn phí, fork từ VestaCP.',
|
||||
'is_active' => true,
|
||||
'sort_order' => 6,
|
||||
],
|
||||
[
|
||||
'name' => 'Không có Panel',
|
||||
'slug' => 'no-panel',
|
||||
'logo' => null,
|
||||
'description' => 'Không cài đặt control panel, quản lý server thủ công qua SSH.',
|
||||
'is_active' => true,
|
||||
'sort_order' => 99,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($panels as $panel) {
|
||||
ControlPanel::updateOrCreate(
|
||||
['slug' => $panel['slug']],
|
||||
$panel
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,5 +30,6 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(TemplateSeeder::class);
|
||||
$this->call(Setting::class);
|
||||
$this->call(MenuSeeder::class);
|
||||
$this->call(ControlPanelSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user