where('tenant_codigo', $tenant->codigo) ->where('codigo', 'color') ->first(); if ($existingColor) { Product::deleteAttribute($existingColor); } Product::createAttribute($tenant, [ 'codigo' => 'color', 'nombre' => 'Color', 'type' => FieldType::Select->value, 'is_required' => true, 'metadata_schema' => [ 'hex' => ['type' => 'string'], ], 'options' => [ [ 'value' => 'Negro', 'label' => 'Negro', 'sort_order' => 1, 'metadata' => ['hex' => '#000000'], ], [ 'value' => 'Gris', 'label' => 'Gris', 'sort_order' => 2, 'metadata' => ['hex' => '#808080'], ], [ 'value' => 'Blanco', 'label' => 'Blanco', 'sort_order' => 3, 'metadata' => ['hex' => '#FFFFFF'], ], [ 'value' => 'Azul', 'label' => 'Azul', 'sort_order' => 4, 'metadata' => ['hex' => '#0000FF'], ], ], ]); // Seed Talle (Size - Text options) attribute $existingTalle = Attribute::query() ->where('tenant_codigo', $tenant->codigo) ->where('codigo', 'talle') ->first(); if ($existingTalle) { Product::deleteAttribute($existingTalle); } Product::createAttribute($tenant, [ 'codigo' => 'talle', 'nombre' => 'Talle', 'type' => FieldType::Select->value, 'is_required' => true, 'options' => [ ['value' => 'S', 'label' => 'S', 'sort_order' => 1], ['value' => 'M', 'label' => 'M', 'sort_order' => 2], ['value' => 'L', 'label' => 'L', 'sort_order' => 3], ['value' => 'XL', 'label' => 'XL', 'sort_order' => 4], ], ]); // Seed Talle Numérico (Numeric Size options) attribute $existingTalleNumerico = Attribute::query() ->where('tenant_codigo', $tenant->codigo) ->where('codigo', 'talle_numerico') ->first(); if ($existingTalleNumerico) { Product::deleteAttribute($existingTalleNumerico); } Product::createAttribute($tenant, [ 'codigo' => 'talle_numerico', 'nombre' => 'Talle Numérico', 'type' => FieldType::Select->value, 'is_required' => true, 'options' => [ ['value' => '38', 'label' => '38', 'sort_order' => 1], ['value' => '40', 'label' => '40', 'sort_order' => 2], ['value' => '42', 'label' => '42', 'sort_order' => 3], ['value' => '44', 'label' => '44', 'sort_order' => 4], ], ]); } } }