feat: implement product attribute options with database migration, resource, and validation requests

This commit is contained in:
2026-06-29 09:48:56 -03:00
parent b0508d79b3
commit 6efda4727f
7 changed files with 10 additions and 1 deletions

View File

@@ -37,7 +37,7 @@ class CartControllerTest extends TestCase
'tenant_codigo' => 'acme',
'codigo' => 'color',
'nombre' => 'Color',
'type' => 'text',
'type' => 'string',
]);
ProductVariantDefinition::query()->create([

View File

@@ -24,11 +24,13 @@ class ProductAttributeControllerTest extends TestCase
],
'options' => [
[
'value' => 'red',
'label' => 'Red',
'sort_order' => 1,
'metadata' => ['hex' => '#ff0000'],
],
[
'value' => 'blue',
'label' => 'Blue',
'sort_order' => 2,
'metadata' => ['hex' => '#0000ff'],
@@ -41,6 +43,7 @@ class ProductAttributeControllerTest extends TestCase
->assertJsonPath('data.tenant_codigo', 'acme')
->assertJsonPath('data.codigo', 'color')
->assertJsonPath('data.type', 'select')
->assertJsonPath('data.options.0.value', 'red')
->assertJsonPath('data.options.0.label', 'Red')
->assertJsonPath('data.options.1.metadata.hex', '#0000ff');
@@ -51,6 +54,7 @@ class ProductAttributeControllerTest extends TestCase
]);
$this->assertDatabaseHas('attribute_options', [
'value' => 'red',
'label' => 'Red',
'sort_order' => 1,
]);