src/Http/Controllers/Traits/BreadRelationshipParser.php
protected function getRelationships(DataType $dataType)
    {
        $relationships = [];

        $dataType->browseRows->each(function ($item) use (&$relationships) {
            $details = json_decode($item->details);
            if (isset($details->relationship) && isset($item->field)) {
                $relation = $details->relationship;
                if (isset($relation->method)) {
                    $method = $relation->method;
                    $this->patchId[$method] = true;
                } else {
                    $method = camel_case($item->field);
                    $this->patchId[$method] = false;
                }

                if (strpos($relation->key, '.') > 0) {
                    $this->patchId[$method] = false;
                }

                $relationships[$method] = function ($query) use ($relation) {
                    // select only what we need
                    $query->select($relation->key, $relation->label);
                };
            }
        });

        return $relationships;
    }
protected function getRelationships(DataType $dataType)
    {
        $relationships = [];

        $dataType->browseRows->each(function ($item) use (&$relationships) {
            $details = json_decode($item->details);
            if (isset($details->relationship) && isset($item->field)) {
                $relation = $details->relationship;
                if (isset($relation->method)) {
                    $method = $relation->method;
                    $this->patchId[$method] = true;
                } else {
                    $method = camel_case($item->field);
                    $this->patchId[$method] = false;
                }

                if (strpos($relation->key, '.') > 0) {
                    $this->patchId[$method] = false;
                }

                $relationships[$method] = function ($query) use ($relation) {
                    // select only what we need
                    $query->select($relation->key, $relation->label);
                };
            }
        });

        return $relationships;
    }
protected function getRelationships ( DataType $ dataType ) { $ relationships = [ ] ; $ dataType -> browseRows -> each ( function ( $ item ) use ( & $ relationships ) { $ details = json_decode ( $ item -> details ) ; if ( isset ( $ details -> relationship ) && isset ( $ item -> field ) ) { $ relation = $ details -> relationship ; if ( isset ( $ relation -> method ) ) { $ method = $ relation -> method ; $ this -> patchId [ $ method ] = true ; } else { $ method = camel_case ( $ item -> field ) ; $ this -> patchId [ $ method ] = false ; } if ( strpos ( $ relation -> key , '.' ) > 0 ) { $ this -> patchId [ $ method ] = false ; } $ relationships [ $ method ] = function ( $ query ) use ( $ relation ) { // select only what we need $ query -> select ( $ relation -> key , $ relation -> label ) ; } ; } } ) ; return $ relationships ; }
Build the relationships array for the model's eager load.

@param DataType $dataType

@return array
Build the relationships array for the model s eager load .