classes/Collections/Elements.php
public function asModels()
    {
        $this->hydrate();

        return new ModelCollection(array_map(function ($element, $key) {

            // Add the key as an attribute
            return new $this->model(array_merge($element, ['key' => $key]));
        }, $this->all(), array_keys($this->items)));
    }
public function asModels()
    {
        $this->hydrate();

        return new ModelCollection(array_map(function ($element, $key) {

            // Add the key as an attribute
            return new $this->model(array_merge($element, ['key' => $key]));
        }, $this->all(), array_keys($this->items)));
    }
public function asModels ( ) { $ this -> hydrate ( ) ; return new ModelCollection ( array_map ( function ( $ element , $ key ) { // Add the key as an attribute return new $ this -> model ( array_merge ( $ element , [ 'key' => $ key ] ) ) ; } , $ this -> all ( ) , array_keys ( $ this -> items ) ) ) ; }
Map the items into a collection of Element instances

@return Bkwld\Decoy\Collections\Elements
Map the items into a collection of Element instances