protected function makeModelFormFieldDataForRelationData(ModelRelationData $relation, $key = null)
    {
        $required = (   in_array($relation->type, [
                            RelationType::BELONGS_TO,
                            RelationType::BELONGS_TO_THROUGH,
                            RelationType::MORPH_TO,
                        ])
                    &&  ! $relation->nullable_key);

        // Shows any relation, regardless of type. Note that this is not optimal for
        // records with a large number of to-many related items, for instance.

        return new ModelFormFieldData([
            'key'              => $key ?: $relation->name,
            'source'           => $relation->method,
            'required'         => $required,
            'translated'       => $relation->translated,
            'display_strategy' => $this->determineFormDisplayStrategyForRelation($relation),
            'store_strategy'   => $this->determineFormStoreStrategyForRelation($relation),
            'options'          => $this->determineFormStoreOptionsForRelation($relation),
        ]);
    }
protected function makeModelFormFieldDataForRelationData(ModelRelationData $relation, $key = null)
    {
        $required = (   in_array($relation->type, [
                            RelationType::BELONGS_TO,
                            RelationType::BELONGS_TO_THROUGH,
                            RelationType::MORPH_TO,
                        ])
                    &&  ! $relation->nullable_key);

        // Shows any relation, regardless of type. Note that this is not optimal for
        // records with a large number of to-many related items, for instance.

        return new ModelFormFieldData([
            'key'              => $key ?: $relation->name,
            'source'           => $relation->method,
            'required'         => $required,
            'translated'       => $relation->translated,
            'display_strategy' => $this->determineFormDisplayStrategyForRelation($relation),
            'store_strategy'   => $this->determineFormStoreStrategyForRelation($relation),
            'options'          => $this->determineFormStoreOptionsForRelation($relation),
        ]);
    }
protected function makeModelFormFieldDataForRelationData ( ModelRelationData $ relation , $ key = null ) { $ required = ( in_array ( $ relation -> type , [ RelationType :: BELONGS_TO , RelationType :: BELONGS_TO_THROUGH , RelationType :: MORPH_TO , ] ) && ! $ relation -> nullable_key ) ; // Shows any relation, regardless of type. Note that this is not optimal for // records with a large number of to-many related items, for instance. return new ModelFormFieldData ( [ 'key' => $ key ? : $ relation -> name , 'source' => $ relation -> method , 'required' => $ required , 'translated' => $ relation -> translated , 'display_strategy' => $ this -> determineFormDisplayStrategyForRelation ( $ relation ) , 'store_strategy' => $ this -> determineFormStoreStrategyForRelation ( $ relation ) , 'options' => $ this -> determineFormStoreOptionsForRelation ( $ relation ) , ] ) ; }
Makes data set for form field given relation data.

@param ModelRelationData $relation
@param string|null       $key
@return ModelFormFieldData
Makes data set for form field given relation data .