Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

merge collections laravel

$collection = collect(['product_id' => 1, 'price' => 100]);

$merged = $collection->merge(['price' => 200, 'discount' => false]);

$merged->all();

// ['product_id' => 1, 'price' => 200, 'discount' => false]
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #merge #collections #laravel
ADD COMMENT
Topic
Name
5+5 =