vendor/laravel/framework/src/Illuminate/Support/Collection.php
/**
     * Partition the collection into two arrays using the given callback or key.
     *
     * @param  callable|string  $callback
     * @return static
     */
Partition the collection into two arrays using the given callback or key.
@param  callable|string  $callback
@return static
Partition the collection into two arrays using the given callback or key . @param callable|string $callback @return static
public function partition($callback)
    {
        $partitions = [new static, new static];
        $callback = $this->valueRetriever($callback);
        foreach ($this->items as $key => $item) {
            $partitions[(int) ! $callback($item)][$key] = $item;
        }
        return new static($partitions);
    }
public function partition ( $ callback ) { $ partitions = [ new static , new static ] ; $ callback = $ this -> valueRetriever ( $ callback ) ; foreach ( $ this -> items as $ key => $ item ) { $ partitions [ ( int ) ! $ callback ( $ item ) ] [ $ key ] = $ item ; } return new static ( $ partitions ) ; }
Partition the collection into two arrays using the given callback or key.
Partition the collection into two arrays using the given callback or key .