I have this object in my session
name: "test",
is_feature: "0",
attributes: [
{
'5': "blue"
},
{
'7': "iOS"
}
],
cost: "2000",
I want to use attributes in foreach.some thing like below code:
foreach ($product->attributes as $attribute){
ProductAttributeValue::create([
'attribute_id' => $attribute->key, //like 5,7
'value' => $attribute->value //like blue,iOS
]);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire