阅读(2289) (0)

Laravel 8 concat() {#collection-method}

2021-07-01 14:27:49 更新

concat 方法在集合的末端附加指定的 数组 或集合值:

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

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

$concatenated->all();

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