In die Sammlung Laravel hinzufügen
$item = collect();
$item->push($product);
Grotesque Gibbon
$item = collect();
$item->push($product);
$items->put('products', $product);
$collection = collect([1, 2, 3, 4]);
$collection->push(5);
$collection->all();
// [1, 2, 3, 4, 5]
$name = DB::table('users')->where('name', 'John')->pluck('name');
$collection = collect([1,2,3,4]);
$collection->each(function($item){
return $item*$item;
});
// [1,4,9,16]
If you want to add a product into the array you can use:
$item['product'] = $product;