public function keyBy($keyBy)
        {
            $results = array();

            foreach ($this->_items as $item) {
                $key = dataGet($item, $keyBy);
                $results[$key] = $item;
            }

            return new self($results);
        }
public function keyBy($keyBy)
        {
            $results = array();

            foreach ($this->_items as $item) {
                $key = dataGet($item, $keyBy);
                $results[$key] = $item;
            }

            return new self($results);
        }
public function keyBy ( $ keyBy ) { $ results = array ( ) ; foreach ( $ this -> _items as $ item ) { $ key = dataGet ( $ item , $ keyBy ) ; $ results [ $ key ] = $ item ; } return new self ( $ results ) ; }
Key an associative array by a field.

@param  string  $keyBy
@return Collection
Key an associative array by a field .