laravel集合where查找方法

where 方法,可以像数据库查询方法where()一样通过给定键值对过滤集合

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

/*
[
1 =>['product' => 'Chair', 'price' => 100],
3 =>['product' => 'Door', 'price' => 100],
]
*/

```

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

发表评论

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