Skip to content

Commit 54e9b6e

Browse files
committed
Enhance attribute value retrieval by adding 'label' field selection
This commit updates the getAttributeValueByAttributeId method in the ListCategoryController to include the 'label' field in the selection of attribute values. Additionally, the migration for the attribute_values table is modified to add a nullable 'label' column, improving the data structure and enhancing the information returned for attribute values.
1 parent 785a9e2 commit 54e9b6e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

app/Http/Controllers/ListCategoryController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function getAttributeValueByAttributeId($attributeId){
137137
$values = DB::table('attribute_values')
138138
->where('attribute_value_group_id', $group->id)
139139
->where('attribute_id',$attributeId)
140-
->select('id', 'value')
140+
->select('id', 'value','label')
141141
->get();
142142

143143
$result[] = [

database/migrations/2024_11_26_203324_create_attribute_values_table.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function up(): void
2626
->nullOnDelete();
2727
$table->string("value");
2828
$table->string("hex_color")->nullable();
29+
$table->string("label")->nullable();
2930
$table->timestamps();
3031
});
3132
}

0 commit comments

Comments
 (0)