У меня есть этот объект в моем сеансе
name: "test",
is_feature: "0",
attributes: [
{
'5': "blue"
},
{
'7': "iOS"
}
],
cost: "2000",
Я хочу использовать атрибуты в foreach.some, как показано ниже:
foreach ($product->attributes as $attribute){
ProductAttributeValue::create([
'attribute_id' => $attribute->key, //like 5,7
'value' => $attribute->value //like blue,iOS
]);
}