src/Http/Normalizr.php
public function injectData($data, $rawIncludedData)
    {
        $entityKey = key($data);

        // Normalise entity
        foreach ($data as $entity) {
            if (isset($entity[0])) { // is a collection
                foreach ($entity as $collectionItem) {
                    $this->insertEntity($entityKey, $collectionItem, $rawIncludedData);
                }
            } else { // is a single item
                $this->insertEntity($entityKey, $entity, $rawIncludedData);
            }
        }

        return $this->normalised;
    }
public function injectData($data, $rawIncludedData)
    {
        $entityKey = key($data);

        // Normalise entity
        foreach ($data as $entity) {
            if (isset($entity[0])) { // is a collection
                foreach ($entity as $collectionItem) {
                    $this->insertEntity($entityKey, $collectionItem, $rawIncludedData);
                }
            } else { // is a single item
                $this->insertEntity($entityKey, $entity, $rawIncludedData);
            }
        }

        return $this->normalised;
    }
public function injectData ( $ data , $ rawIncludedData ) { $ entityKey = key ( $ data ) ; // Normalise entity foreach ( $ data as $ entity ) { if ( isset ( $ entity [ 0 ] ) ) { // is a collection foreach ( $ entity as $ collectionItem ) { $ this -> insertEntity ( $ entityKey , $ collectionItem , $ rawIncludedData ) ; } } else { // is a single item $ this -> insertEntity ( $ entityKey , $ entity , $ rawIncludedData ) ; } } return $ this -> normalised ; }
Hook for the serializer to inject custom data based on the relationships of the resource.

@param array $data
@param array $rawIncludedData

@return array
Hook for the serializer to inject custom data based on the relationships of the resource .