src/Http/Controllers/Traits/BreadRelationshipParser.php
protected function resolveRelations($dataTypeContent, DataType $dataType)
    {
        // In case of using server-side pagination, we need to work on the Collection (BROWSE)
        if ($dataTypeContent instanceof LengthAwarePaginator) {
            $dataTypeCollection = $dataTypeContent->getCollection();
        }
        // If it's a model just make the changes directly on it (READ / EDIT)
        elseif ($dataTypeContent instanceof Model) {
            return $this->relationToLink($dataTypeContent, $dataType);
        }
        // Or we assume it's a Collection
        else {
            $dataTypeCollection = $dataTypeContent;
        }

        $dataTypeCollection->transform(function ($item) use ($dataType) {
            return $this->relationToLink($item, $dataType);
        });

        return $dataTypeContent instanceof LengthAwarePaginator ? $dataTypeContent->setCollection($dataTypeCollection) : $dataTypeCollection;
    }
protected function resolveRelations($dataTypeContent, DataType $dataType)
    {
        // In case of using server-side pagination, we need to work on the Collection (BROWSE)
        if ($dataTypeContent instanceof LengthAwarePaginator) {
            $dataTypeCollection = $dataTypeContent->getCollection();
        }
        // If it's a model just make the changes directly on it (READ / EDIT)
        elseif ($dataTypeContent instanceof Model) {
            return $this->relationToLink($dataTypeContent, $dataType);
        }
        // Or we assume it's a Collection
        else {
            $dataTypeCollection = $dataTypeContent;
        }

        $dataTypeCollection->transform(function ($item) use ($dataType) {
            return $this->relationToLink($item, $dataType);
        });

        return $dataTypeContent instanceof LengthAwarePaginator ? $dataTypeContent->setCollection($dataTypeCollection) : $dataTypeCollection;
    }
protected function resolveRelations ( $ dataTypeContent , DataType $ dataType ) { // In case of using server-side pagination, we need to work on the Collection (BROWSE) if ( $ dataTypeContent instanceof LengthAwarePaginator ) { $ dataTypeCollection = $ dataTypeContent -> getCollection ( ) ; } // If it's a model just make the changes directly on it (READ / EDIT) elseif ( $ dataTypeContent instanceof Model ) { return $ this -> relationToLink ( $ dataTypeContent , $ dataType ) ; } // Or we assume it's a Collection else { $ dataTypeCollection = $ dataTypeContent ; } $ dataTypeCollection -> transform ( function ( $ item ) use ( $ dataType ) { return $ this -> relationToLink ( $ item , $ dataType ) ; } ) ; return $ dataTypeContent instanceof LengthAwarePaginator ? $ dataTypeContent -> setCollection ( $ dataTypeCollection ) : $ dataTypeCollection ; }
Replace relationships' keys for labels and create READ links if a slug is provided.

@param  $dataTypeContent     Can be either an eloquent Model, Collection or LengthAwarePaginator instance.
@param DataType $dataType

@return $dataTypeContent
Replace relationships keys for labels and create READ links if a slug is provided .