[
"bob" => $books
"maria" => $otherBooks
]至
[
[
name => "bob"
data => $books
],
[
name => "maria"
data => $otherBooks
]
]发布于 2020-07-31 21:30:35
使用集合可以很容易地做到这一点。
collect([
"bob" => $books
"maria" => $otherBooks
])->map(function ($books, $name) {
return [
'name' => $name,
'data' => $books
];
});https://stackoverflow.com/questions/63192500
复制相似问题