Skip to content

Commit fea7462

Browse files
committed
Merge branch '8.x'
# Conflicts: # src/Illuminate/Foundation/Application.php
2 parents 1a2b767 + c7d7d0a commit fea7462

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Collection.php

+11
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,17 @@ public function split($numberOfGroups)
10411041
return $groups;
10421042
}
10431043

1044+
/**
1045+
* Split a collection into a certain number of groups, and fill the first groups completely.
1046+
*
1047+
* @param int $numberOfGroups
1048+
* @return static
1049+
*/
1050+
public function splitIn($numberOfGroups)
1051+
{
1052+
return $this->chunk(ceil($this->count() / $numberOfGroups));
1053+
}
1054+
10441055
/**
10451056
* Chunk the collection into chunks of the given size.
10461057
*

LazyCollection.php

+11
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,17 @@ public function chunk($size)
10571057
});
10581058
}
10591059

1060+
/**
1061+
* Split a collection into a certain number of groups, and fill the first groups completely.
1062+
*
1063+
* @param int $numberOfGroups
1064+
* @return static
1065+
*/
1066+
public function splitIn($numberOfGroups)
1067+
{
1068+
return $this->chunk(ceil($this->count() / $numberOfGroups));
1069+
}
1070+
10601071
/**
10611072
* Chunk the collection into chunks with a callback.
10621073
*

0 commit comments

Comments
 (0)