【发布时间】:2021-07-12 10:56:09
【问题描述】:
我无法将值放入集合 laravel
我读过这个有同样的问题,但对我没有用
这是我的收藏
Illuminate\Support\Collection {#1348
#items: array:9 [
0 => {#1350
+"id": 532
+"id_user": "BR001"
+"name": "Jack"
+"department": "HR
+"City": "London"
+"updated_at": "2021-04-08 15:37:32"
}
1 => {#1351
+"id": 522
+"id_user": "BR002"
+"name": "Rose"
+"department": "IR"
+"city": "London"
+"updated_at": "2021-04-08 15:36:19"
}
2 => {#1352
+"id": 532
+"id_user": "AR023"
+"name": "Michael"
+"department": "RnD"
+"City": "London"
+"updated_at": "2021-04-08 15:45:43"
}
预期输出
Illuminate\Support\Collection {#1348
#items: array:9 [
0 => {#1350
+"id": 532
+"id_user": "BR001"
+"name": "Jack"
+"department": "HR
+"City": "London"
+"updated_at": "2021-04-08 15:37:32"
+"Status": "Single"
}
1 => {#1351
+"id": 522
+"id_user": "BR002"
+"name": "Rose"
+"department": "IR"
+"city": "London"
+"updated_at": "2021-04-08 15:36:19"
+"Status": "Single"
}
2 => {#1352
+"id": 532
+"id_user": "AR023"
+"name": "Michael"
+"department": "RnD"
+"City": "London"
+"updated_at": "2021-04-08 15:45:43"
+"Status": "Single"
}
如何添加 +"Status": "Single" ?
任何帮助将不胜感激
谢谢
【问题讨论】:
-
您希望数组中所有项目的状态为单一还是有条件
标签: php arrays laravel collections