阅读(1837)
赞(5)
Laravel 8 pipe() {#collection-method}
2021-07-01 15:42:02 更新
pipe
可以把集合放到回调参数中并返回回调的结果:
$collection = collect([1, 2, 3]);
$piped = $collection->pipe(function ($collection) {
return $collection->sum();
});
// 6
pipe
可以把集合放到回调参数中并返回回调的结果:
$collection = collect([1, 2, 3]);
$piped = $collection->pipe(function ($collection) {
return $collection->sum();
});
// 6