“Laravel Collection Concat” Respostas de código

Laravel Collection Concat

$collection = collect(['John Doe']);

$concatenated = $collection->concat(['Jane Doe'])->concat(['name' => 'Johnny Doe']);

$concatenated->all();

// ['John Doe', 'Jane Doe', 'Johnny Doe'] 
Cooperative Crab

Laravel Collection Merge

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

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

$merged->all();

// ['product_id' => 1, 'price' => 200, 'discount' => false]
Tough Tarsier

Respostas semelhantes a “Laravel Collection Concat”

Perguntas semelhantes a “Laravel Collection Concat”

Mais respostas relacionadas para “Laravel Collection Concat” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código