public function setData()
    {
        // Process a collection
        if ($this->resource instanceof Collection) {
            $this->data = [];

            foreach ($this->resource->getData() as $resource) {
                $this->parseItem(new Item($resource, $this->resource->getTransformer()));
            }
        }

        // Process an item
        elseif ($this->resource instanceof Item) {
            $this->parseItem($this->resource);
        }

        return $this;
    }
public function setData()
    {
        // Process a collection
        if ($this->resource instanceof Collection) {
            $this->data = [];

            foreach ($this->resource->getData() as $resource) {
                $this->parseItem(new Item($resource, $this->resource->getTransformer()));
            }
        }

        // Process an item
        elseif ($this->resource instanceof Item) {
            $this->parseItem($this->resource);
        }

        return $this;
    }
public function setData ( ) { // Process a collection if ( $ this -> resource instanceof Collection ) { $ this -> data = [ ] ; foreach ( $ this -> resource -> getData ( ) as $ resource ) { $ this -> parseItem ( new Item ( $ resource , $ this -> resource -> getTransformer ( ) ) ) ; } } // Process an item elseif ( $ this -> resource instanceof Item ) { $ this -> parseItem ( $ this -> resource ) ; } return $ this ; }
Creates the response

@return $this Instance of self
Creates the response