public function transform($object)
    {
        if (($collection = $this->normalize($object)) instanceof Collection) {
            return $this->transformCollection($collection);
        }

        // If there are relations setup, transform it along with the object.
        if ($this->relatedCount) {
            return $this->transformWithRelated($object);
        }

        // If another transformation method was requested, use that instead.
        if (is_callable($this->transformationMethod)) {
            return $this->getAlternateTransformation($object);
        }

        return $this->getTransformation($object);
    }
public function transform($object)
    {
        if (($collection = $this->normalize($object)) instanceof Collection) {
            return $this->transformCollection($collection);
        }

        // If there are relations setup, transform it along with the object.
        if ($this->relatedCount) {
            return $this->transformWithRelated($object);
        }

        // If another transformation method was requested, use that instead.
        if (is_callable($this->transformationMethod)) {
            return $this->getAlternateTransformation($object);
        }

        return $this->getTransformation($object);
    }
public function transform ( $ object ) { if ( ( $ collection = $ this -> normalize ( $ object ) ) instanceof Collection ) { return $ this -> transformCollection ( $ collection ) ; } // If there are relations setup, transform it along with the object. if ( $ this -> relatedCount ) { return $ this -> transformWithRelated ( $ object ) ; } // If another transformation method was requested, use that instead. if ( is_callable ( $ this -> transformationMethod ) ) { return $ this -> getAlternateTransformation ( $ object ) ; } return $ this -> getTransformation ( $ object ) ; }
Transforms the object.
Called recursively when transforming a collection or a relation.

@param $object
@return array|mixed
Transforms the object . Called recursively when transforming a collection or a relation .