src/TransformBuilder.php
public function resource($data = null, $transformer = null, string $resourceKey = null)
    {
        $this->resource = $this->resourceFactory->make($data, $transformer, $resourceKey);

        if ($data instanceof CursorPaginator) {
            $this->cursor($this->paginatorFactory->makeCursor($data));
        } elseif ($data instanceof LengthAwarePaginator) {
            $this->paginator($this->paginatorFactory->make($data));
        }

        return $this;
    }
public function resource($data = null, $transformer = null, string $resourceKey = null)
    {
        $this->resource = $this->resourceFactory->make($data, $transformer, $resourceKey);

        if ($data instanceof CursorPaginator) {
            $this->cursor($this->paginatorFactory->makeCursor($data));
        } elseif ($data instanceof LengthAwarePaginator) {
            $this->paginator($this->paginatorFactory->make($data));
        }

        return $this;
    }
Make a resource from the given data and transformer and set the resource key.

@param  mixed                                                          $data
@param  \Flugg\Responder\Transformers\Transformer|callable|string|null $transformer
@param  string|null                                                    $resourceKey
@return $this