collection all in laravel code example
Example 1: laravel collection methods
$collection = collect([1,2,3,4]);
$collection->each(function($item){
return $item*$item;
});
// [1,4,9,16]
Example 2: collection methods laravel
$collection->each(function ($item, $key) {
hj
});