操作类
1. collect() , make() , times()
2. dd() , dump()
3. marco()
4. pipe() , pipeInto() , tap()
$collection = collect([1, 2, 3]);
$piped = $collection->pipe(function ($collection) {
return $collection->sum();
});
// 6
collect([2, 4, 3, 1, 5])
->sort()
->tap(function ($collection) {
Log::debug('Values after sorting', $collection->values()->all());
})
->shift();
// 15. random() , shuffle()
6. wrap() , unwrap()
7. unless() , when() , empty() , notEmpty()
最后更新于