File tree 2 files changed +22
-0
lines changed
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1041,6 +1041,17 @@ public function split($numberOfGroups)
1041
1041
return $ groups ;
1042
1042
}
1043
1043
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
+
1044
1055
/**
1045
1056
* Chunk the collection into chunks of the given size.
1046
1057
*
Original file line number Diff line number Diff line change @@ -1057,6 +1057,17 @@ public function chunk($size)
1057
1057
});
1058
1058
}
1059
1059
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
+
1060
1071
/**
1061
1072
* Chunk the collection into chunks with a callback.
1062
1073
*
You can’t perform that action at this time.
0 commit comments