public function keysByField($keyBy)
    {
        $byField = [];

        $keyBy = $this->getStringable($keyBy);

        foreach ($this->items as $item)
        {
            $key = _data_get($item, $keyBy);

            $byField[$key] = $item;
        }

        return new static($byField);
    }
public function keysByField($keyBy)
    {
        $byField = [];

        $keyBy = $this->getStringable($keyBy);

        foreach ($this->items as $item)
        {
            $key = _data_get($item, $keyBy);

            $byField[$key] = $item;
        }

        return new static($byField);
    }
public function keysByField ( $ keyBy ) { $ byField = [ ] ; $ keyBy = $ this -> getStringable ( $ keyBy ) ; foreach ( $ this -> items as $ item ) { $ key = _data_get ( $ item , $ keyBy ) ; $ byField [ $ key ] = $ item ; } return new static ( $ byField ) ; }
Key an associative array by a field.

@param  string|StringContract  $keyBy
@return static
Key an associative array by a field .