diff --git a/app/Domains/Product/Models/FeaturedGroup.php b/app/Domains/Product/Models/FeaturedGroup.php new file mode 100644 index 0000000..3015e08 --- /dev/null +++ b/app/Domains/Product/Models/FeaturedGroup.php @@ -0,0 +1,20 @@ +hasMany(FeaturedProduct::class); + } +} diff --git a/app/Domains/Product/Models/FeaturedProduct.php b/app/Domains/Product/Models/FeaturedProduct.php new file mode 100644 index 0000000..2e54f22 --- /dev/null +++ b/app/Domains/Product/Models/FeaturedProduct.php @@ -0,0 +1,25 @@ +belongsTo(FeaturedGroup::class); + } + + public function product(): BelongsTo + { + return $this->belongsTo(Product::class); + } +} diff --git a/database/migrations/2026_07_14_161848_create_featured_groups_table.php b/database/migrations/2026_07_14_161848_create_featured_groups_table.php new file mode 100644 index 0000000..15ac9a7 --- /dev/null +++ b/database/migrations/2026_07_14_161848_create_featured_groups_table.php @@ -0,0 +1,30 @@ +id(); + $table->string('tenant_codigo'); + $table->string('group_name'); + $table->enum('product_layout', ['row', 'column_with_image', 'column_with_cart']); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('featured_groups'); + } +}; diff --git a/database/migrations/2026_07_14_161849_create_featured_products_table.php b/database/migrations/2026_07_14_161849_create_featured_products_table.php new file mode 100644 index 0000000..cae9a84 --- /dev/null +++ b/database/migrations/2026_07_14_161849_create_featured_products_table.php @@ -0,0 +1,30 @@ +id(); + $table->foreignId('featured_group_id')->constrained('featured_groups')->onDelete('cascade'); + $table->unsignedBigInteger('product_id'); + $table->integer('order')->default(0); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('featured_products'); + } +};