feat(catalog): enhance featured groups with paginated and carousel layouts, update seeder and tests
This commit is contained in:
@@ -168,12 +168,12 @@ class ProductCatalogFromImagesSeeder extends Seeder
|
||||
{
|
||||
FeaturedGroup::query()->where('tenant_code', $tenant->codigo)->delete();
|
||||
|
||||
$group = FeaturedGroup::query()->create([
|
||||
$paginatedGroup = FeaturedGroup::query()->create([
|
||||
'tenant_code' => $tenant->codigo,
|
||||
'product_layout' => ProductLayout::ColumnWithImage,
|
||||
'group_layout' => GroupLayout::Paginated,
|
||||
'group_name' => 'Productos',
|
||||
'group_order' => 0,
|
||||
'group_order' => 2,
|
||||
]);
|
||||
|
||||
$items = CatalogItem::query()
|
||||
@@ -181,7 +181,7 @@ class ProductCatalogFromImagesSeeder extends Seeder
|
||||
->orderBy('id')
|
||||
->get('id');
|
||||
|
||||
$group->featuredItems()->createMany(
|
||||
$paginatedGroup->featuredItems()->createMany(
|
||||
$items->values()->map(
|
||||
fn (CatalogItem $item, int $order): array => [
|
||||
'catalog_item_id' => $item->id,
|
||||
@@ -189,6 +189,29 @@ class ProductCatalogFromImagesSeeder extends Seeder
|
||||
]
|
||||
)->all()
|
||||
);
|
||||
|
||||
$carouselGroup = FeaturedGroup::query()->create([
|
||||
'tenant_code' => $tenant->codigo,
|
||||
'product_layout' => ProductLayout::ColumnWithImage,
|
||||
'group_layout' => GroupLayout::Carousel,
|
||||
'group_name' => 'Productos destacados',
|
||||
'group_order' => 1,
|
||||
]);
|
||||
|
||||
$randomItems = CatalogItem::query()
|
||||
->where('tenant_code', $tenant->codigo)
|
||||
->inRandomOrder()
|
||||
->limit(5)
|
||||
->get('id');
|
||||
|
||||
$carouselGroup->featuredItems()->createMany(
|
||||
$randomItems->values()->map(
|
||||
fn (CatalogItem $item, int $order): array => [
|
||||
'catalog_item_id' => $item->id,
|
||||
'order' => $order,
|
||||
]
|
||||
)->all()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user