【发布时间】:2019-08-08 12:55:30
【问题描述】:
我的会话中有这个对象
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
]);
}
【问题讨论】:
-
有什么问题?
标签: php arrays laravel laravel-5