我试图根据外汇中包含的请求来操作一个集合。作为输出,我收到了一个包含一系列对象的集合..。
我需要的是一个数组女巫集合包含我的属性..。这就是我对dd($users)的理解:
Collection {#551 ▼
#items: array:16 [▼
0 => User {#610 ▼
#table: "users"
#fillable: array:13 [▶]
#guarded: array:1 [▶]
#hidden: array:2 [▶]
#timestamp: true
#softDelete: true
#attributes: array:15 [▼
"id" => 1
"ua_id" => 351
"grade_id" => 584
"metier_id" => 18
"nom" => "xxxx"
"prenom" => "xxxx"
"matricule" => "xxxx"
"email" => null
"datenaissance" => "xxxx"
"password" => "xxxxx"
...这就是我想要的
Collection {#2114 ▼
#items: array:16 [▼
1 => array:15 [▼
"id" => 1
"ua_id" => 351
"grade_id" => 584
"metier_id" => 18
"nom" => "xxxx"
"prenom" => "xxxx"
"matricule" => "xxxx"
"email" => null
"datenaissance" => "xxxx"
"password" => "xxxxx"
...发布于 2018-03-29 14:04:49
试着使用
$newCollection =oldCollection($oldCollection->toArray());
这将将旧集合转换为数组,将此数组转换为集合。
https://stackoverflow.com/questions/49553178
复制相似问题