Laravel - Collections - Method Pipe

The pipe method passes the collection to the given closure and returns the result of the executed closure:

    
    $collection = collect([1, 2, 3]);
    
    $piped = $collection->pipe(function ($collection) {
        return $collection->sum();
    });
    
    // 6