Answers for "laravel collection transform"

PHP
0

laravel collection transform

$collection = collect([1, 2, 3, 4, 5]);

$collection->transform(function ($item, $key) {
    return $item * 2;
});

$collection->all();

// [2, 4, 6, 8, 10]
Posted by: Guest on July-24-2021

Code answers related to "laravel collection transform"

Browse Popular Code Answers by Language