Laravel 8 combine() {#collection-method}
combine
方法将一个集合的值作为键,与另一个数组或集合的值进行结合:
$collection = collect(['name', 'age']);
$combined = $collection->combine(['George', 29]);
$combined->all();
// ['name' => 'George', 'age' => 29]
combine
方法将一个集合的值作为键,与另一个数组或集合的值进行结合:
$collection = collect(['name', 'age']);
$combined = $collection->combine(['George', 29]);
$combined->all();
// ['name' => 'George', 'age' => 29]