feat: implement FeaturedVariant and CatalogController for managing featured variants and catalog display
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?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('featured_groups', function (Blueprint $table) {
|
||||
$table->integer('group_order')->default(0)->after('product_layout');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('featured_groups', function (Blueprint $table) {
|
||||
$table->dropColumn('group_order');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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
|
||||
{
|
||||
if (Schema::hasTable('featured_products')) {
|
||||
Schema::rename('featured_products', 'featured_variants');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('featured_variants', 'product_id')) {
|
||||
Schema::table('featured_variants', function (Blueprint $table) {
|
||||
$table->renameColumn('product_id', 'product_variant_id');
|
||||
});
|
||||
}
|
||||
|
||||
Schema::table('featured_variants', function (Blueprint $table) {
|
||||
$table->foreign('product_variant_id')->references('id')->on('productos_variantes')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('featured_variants', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user