Answers for "laravel collection union"

PHP
0

laravel collection union

$collection = collect([1 => ['a'], 2 => ['b']]);

$union = $collection->union([3 => ['c'], 1 => ['b']]);

$union->all();

// [1 => ['a'], 2 => ['b'], 3 => ['c']]
Posted by: Guest on July-24-2021

Browse Popular Code Answers by Language