laravel中集合pluck取指定键的所有值

pluck() 获取某列值

```
$collection = collect([
['product' => 'Desk', 'price' => 200],
['product' => 'Chair', 'price' => 100],
['product' => 'Bookcase', 'price' => 150],
['product' => 'Door', 'price' => 100],
]);
```

$result = $collection->pluck('product')->all();

//["Desk","Chair","Bookcase","Door"];

    A+
发布日期:2022年11月26日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: