feat(seeder): update featured groups configuration with product and group layouts
This commit is contained in:
@@ -139,42 +139,58 @@ class FiestaFutbolInfantilProductSeeder extends Seeder
|
||||
|
||||
$groups = [
|
||||
'Entradas' => [
|
||||
'entrada-general',
|
||||
'entrada-general-todos-los-dias',
|
||||
'product_layout' => ProductLayout::Row,
|
||||
'group_layout' => GroupLayout::SimpleVertical,
|
||||
'slugs' => [
|
||||
'entrada-general',
|
||||
'entrada-general-todos-los-dias',
|
||||
],
|
||||
],
|
||||
'Estacionamiento' => [
|
||||
'estacionamiento-auto',
|
||||
'estacionamiento-moto',
|
||||
'product_layout' => ProductLayout::ColumnWithCart,
|
||||
'group_layout' => GroupLayout::Simple,
|
||||
'slugs' => [
|
||||
'estacionamiento-auto',
|
||||
'estacionamiento-moto',
|
||||
],
|
||||
],
|
||||
'Comidas' => [
|
||||
'hamburguesa-papa-frita',
|
||||
'pancho',
|
||||
'combo-2-panchos-2-hamburguesas',
|
||||
'product_layout' => ProductLayout::ColumnWithCart,
|
||||
'group_layout' => GroupLayout::Simple,
|
||||
'slugs' => [
|
||||
'hamburguesa-papa-frita',
|
||||
'pancho',
|
||||
'combo-2-panchos-2-hamburguesas',
|
||||
],
|
||||
],
|
||||
'Bebidas' => [
|
||||
'coca-cola-500ml',
|
||||
'agua-mineral-1l',
|
||||
'product_layout' => ProductLayout::ColumnWithCart,
|
||||
'group_layout' => GroupLayout::Simple,
|
||||
'slugs' => [
|
||||
'coca-cola-500ml',
|
||||
'agua-mineral-1l',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$catalogItems = CatalogItem::query()
|
||||
->where('tenant_code', $tenant->codigo)
|
||||
->whereIn('slug', collect($groups)->flatten()->all())
|
||||
->whereIn('slug', collect($groups)->pluck('slugs')->flatten()->all())
|
||||
->get()
|
||||
->keyBy('slug');
|
||||
|
||||
$groupOrder = 0;
|
||||
foreach ($groups as $groupName => $slugs) {
|
||||
foreach ($groups as $groupName => $config) {
|
||||
$featuredGroup = FeaturedGroup::query()->create([
|
||||
'tenant_code' => $tenant->codigo,
|
||||
'product_layout' => ProductLayout::Row,
|
||||
'group_layout' => GroupLayout::Paginated,
|
||||
'product_layout' => $config['product_layout'],
|
||||
'group_layout' => $config['group_layout'],
|
||||
'group_name' => $groupName,
|
||||
'group_order' => $groupOrder++,
|
||||
]);
|
||||
|
||||
$featuredGroup->featuredItems()->createMany(
|
||||
collect($slugs)->values()->map(
|
||||
collect($config['slugs'])->values()->map(
|
||||
fn (string $slug, int $order): array => [
|
||||
'catalog_item_id' => $catalogItems->get($slug)->id,
|
||||
'order' => $order,
|
||||
|
||||
Reference in New Issue
Block a user