October\Rain\Database\Relations\MorphTo

Extends
  • Illuminate\Database\Eloquent\Relations\MorphTo
  • Illuminate\Database\Eloquent\Relations\BelongsTo
  • Illuminate\Database\Eloquent\Relations\Relation
Implements
  • Illuminate\Contracts\Database\Query\Builder
  • Illuminate\Contracts\Database\Eloquent\Builder

Public Properties

There are no public properties in the class.

Show inherited public properties

Inherited Public Properties

  • $morphMap - An array to map class names to their morph names in the database. (defined in Illuminate\Database\Eloquent\Relations\Relation)

Protected Properties

protected string $relationName

relationName is the "name" of the relationship.

Show inherited protected properties

Inherited Protected Properties

  • $morphType - The type of the polymorphic relation. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • $models - The models whose relations are being eager loaded. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • $dictionary - All of the models keyed by ID. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • $macroBuffer - A buffer of dynamic calls to query macros. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • $morphableEagerLoads - A map of relations to load for each individual morph type. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • $morphableEagerLoadCounts - A map of relationship counts to load for each individual morph type. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • $morphableConstraints - A map of constraints to apply for each individual morph type. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • $child - The child model instance of the relation. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • $foreignKey - The foreign key of the parent model. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • $ownerKey - The associated key on the parent model. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • $query - The Eloquent query builder instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • $parent - The parent model instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • $related - The related model instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • $constraints - Indicates if the relation is adding constraints. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • $requireMorphMap - Prevents morph relationships without a morph map. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • $selfJoinCount - The count of self joins. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • $macros - The registered string macros. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • $withDefault - Indicates if a default model instance should be used. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)

Public Methods

public __construct()

public __construct(
    $query,
    $parent,
    $foreignKey,
    $otherKey,
    $type,
    $relationName
): void

__construct relationship

public addDefinedConstraints()

public addDefinedConstraints(): void 

addDefinedConstraints to the relation query

public addDefinedConstraintsToQuery()

public addDefinedConstraintsToQuery($query, $args = null): void

public addDefinedConstraintsToRelation()

public addDefinedConstraintsToRelation($relation, $args = null): void

public associate()

public associate(
    Illuminate\Database\Eloquent\Model $model
): Illuminate\Database\Eloquent\Model 

associate the model instance to the given parent.

public dissociate()

public dissociate(): Illuminate\Database\Eloquent\Model 

dissociate previously dissociated model from the given parent.

public getSimpleValue()

public getSimpleValue(): void

getSimpleValue is a helper for getting this relationship simple value, generally useful with form values.

public setSimpleValue()

public setSimpleValue($value): void

setSimpleValue is a helper for setting this relationship using various expected values. For example, $model->relation = $value;

Show inherited public methods

Inherited Public Methods

  • __call() - Handle dynamic method calls to the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • __callStatic() - Dynamically handle calls to the class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • __clone() - Force a clone of the underlying query builder when cloning. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • addConstraints() - Set the base constraints on the relation query. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • addEagerConstraints() - Set the constraints for an eager load of the relation. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • constrain() - Specify constraints on the query for a given morph type. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • createModelByType() - Create a new model instance by type. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • createdAt() - Get the name of the "created at" column. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • disassociate() - Alias of "dissociate" method. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • enforceMorphMap() - Define the morph map for polymorphic relations and require all morphed models to be explicitly mapped. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • flushMacros() - Flush the existing macros. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • get() - Execute the query as a "select" statement. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getBaseQuery() - Get the base query builder driving the Eloquent builder. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getChild() - Get the child of the relationship. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getDictionary() - Get the dictionary used by the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • getEager() - Get the results of the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • getForeignKeyName() - Get the foreign key of the relationship. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getMorphType() - Get the foreign key "type" name. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • getMorphedModel() - Get the model associated with a custom polymorphic type. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getOwnerKeyName() - Get the associated key of the relationship. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getParent() - Get the parent model of the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getParentKey() - Get the key value of the child's foreign key. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getQualifiedForeignKeyName() - Get the fully qualified foreign key of the relationship. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getQualifiedOwnerKeyName() - Get the fully qualified associated key of the relationship. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getQualifiedParentKeyName() - Get the fully qualified parent key name. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getQuery() - Get the underlying query for the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getRelated() - Get the related model of the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getRelationCountHash() - Get a relationship join table hash. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getRelationExistenceCountQuery() - Add the constraints for a relationship count query. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getRelationExistenceQuery() - Add the constraints for a relationship query. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getRelationExistenceQueryForSelfRelation() - Add the constraints for a relationship query on the same table. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getRelationName() - Get the name of the relationship. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getResults() - Get the results of the relationship. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • hasMacro() - Checks if macro is registered. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • initRelation() - Initialize the relation on a set of models. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • is() - Determine if the model is the related instance of the relationship. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • isNot() - Determine if the model is not the related instance of the relationship. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • macro() - Register a custom macro. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • macroCall() - Dynamically handle calls to the class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • match() - Match the eagerly loaded results to their parents. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • mixin() - Mix another object into the class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • morphMap() - Set or get the morph map for polymorphic relations. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • morphWith() - Specify which relations to load for a given morph type. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • morphWithCount() - Specify which relationship counts to load for a given morph type. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • noConstraints() - Run a callback with constraints disabled on the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • rawUpdate() - Run a raw update against the base query. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • relatedUpdatedAt() - Get the name of the related model's "updated at" column. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • requireMorphMap() - Prevent polymorphic relationships from being used without model mappings. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • requiresMorphMap() - Determine if polymorphic relationships require explicit model mapping. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • sole() - Execute the query and get the first result if it's the sole matching record. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • toBase() - Get a base query builder instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • touch() - Touch all of the related models for the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • updatedAt() - Get the name of the "updated at" column. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • withDefault() - Return a new model instance in case the relationship does not exist. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)

Protected Methods

Show inherited protected methods

Inherited Protected Methods

  • buildDictionary() - Build a dictionary with the models. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • buildMorphMapFromModels() - Builds a table-keyed array from model class names. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • compareKeys() - Compare the parent key with the related key. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • forwardCallTo() - Forward a method call to the given object. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • forwardDecoratedCallTo() - Forward a method call to the given object, returning $this if the forwarded call returned itself. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • gatherKeysByType() - Gather all of the foreign keys for a given type. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • getDefaultFor() - Get the default value for this relation. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getDictionaryKey() - Get a dictionary key attribute - casting it to a string if necessary. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • getEagerModelKeys() - Gather the keys from an array of related models. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getKeys() - Get all of the primary keys for an array of models. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getRelatedKeyFrom() - Get the value of the model's associated key. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • getRelationQuery() - Get the query builder that will contain the relationship constraints. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • getResultsByType() - Get all of the relation results for a type. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • matchToMorphParents() - Match the results for a given type to their parents. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • newRelatedInstanceFor() - Make a new related instance for the given model. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • relationHasIncrementingId() - Determine if the related model has an auto-incrementing ID. (defined in Illuminate\Database\Eloquent\Relations\BelongsTo)
  • replayMacros() - Replay stored macro calls on the actual related instance. (defined in Illuminate\Database\Eloquent\Relations\MorphTo)
  • throwBadMethodCallException() - Throw a bad method call exception for the given method. (defined in Illuminate\Database\Eloquent\Relations\Relation)
  • whereInMethod() - Get the name of the "where in" method for eager loading. (defined in Illuminate\Database\Eloquent\Relations\Relation)