concat method will create a new collection by combining the values of the collection instance is called on with the provided
$source. It is important to note that the source must implement the
concat method does not modify the original collection instance, and it will return a new collection instance containing the concatenated items.
public function concat( $source );
The following example demonstrates the basic usage of the
$collectionOne = collect([ 'first', 'second', 'third' ]); $collectionTwo = $collectionOne->concat([ 'third', 'fourth', 'fifth' ]);
After the above example has executed, the
$collectionTwo variable will contain the following items: