src/Collection.php
public function collectData($attributes = null)
    {
        $data = [];
        foreach ($this->models as $model) {
            if ($this->dataCollector instanceof Closure) {
                list($key, $row) = call_user_func($this->dataCollector, $model, $this);
            } else {
                $key = $model->getPrimaryKey();
                $row = $model->getAttributes($attributes);
            }

            if ($key) {
                $data[$key] = $row;
            } else {
                $data[] = $row;
            }
        }

        return $data;
    }
public function collectData($attributes = null)
    {
        $data = [];
        foreach ($this->models as $model) {
            if ($this->dataCollector instanceof Closure) {
                list($key, $row) = call_user_func($this->dataCollector, $model, $this);
            } else {
                $key = $model->getPrimaryKey();
                $row = $model->getAttributes($attributes);
            }

            if ($key) {
                $data[$key] = $row;
            } else {
                $data[] = $row;
            }
        }

        return $data;
    }
public function collectData ( $ attributes = null ) { $ data = [ ] ; foreach ( $ this -> models as $ model ) { if ( $ this -> dataCollector instanceof Closure ) { list ( $ key , $ row ) = call_user_func ( $ this -> dataCollector , $ model , $ this ) ; } else { $ key = $ model -> getPrimaryKey ( ) ; $ row = $ model -> getAttributes ( $ attributes ) ; } if ( $ key ) { $ data [ $ key ] = $ row ; } else { $ data [ ] = $ row ; } } return $ data ; }
Collects data from the stored models.
@param string|array $attributes list of attributes names
@return array
Collects data from the stored models .