public function split($parts)
    {
        $elementsPerChunk = ceil($this->count() / $parts);

        return $this->chunk($elementsPerChunk);
    }
public function split($parts)
    {
        $elementsPerChunk = ceil($this->count() / $parts);

        return $this->chunk($elementsPerChunk);
    }
public function split ( $ parts ) { $ elementsPerChunk = ceil ( $ this -> count ( ) / $ parts ) ; return $ this -> chunk ( $ elementsPerChunk ) ; }
Returns collection of collections created by spliting first Collection to a parts

Example:

When collection has 10 element and we would like to split to 3 separate collections:

$splitted = $collection->split(3);
$splitted->count(); // = 3
$splitted[0]->count(); // = 4
$splitted[1]->count(); // = 4
$splitted[3]->count(); // = 2

@param integer $parts

@return static
Returns collection of collections created by spliting first Collection to a parts