October\Rain\Database\Relations\BelongsTo

Source: ~/vendor/october/rain/src/Database/Relations/BelongsTo.php

Extends:

  • Illuminate\Database\Eloquent\Relations\BelongsTo
  • Illuminate\Database\Eloquent\Relations\Relation

Public properties

There are no public properties in the class.

Show inherited public properties

Inherited public properties

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

Protected properties

protected string $relationName

The "name" of the relationship.

Show inherited protected properties

Inherited protected properties

  • protected $child - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. The child model instance of the relation.
  • protected string $foreignKey - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. The foreign key of the parent model.
  • protected string $ownerKey - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. The associated key on the parent model.
  • protected string $relation - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. The name of the relationship.
  • protected static int $selfJoinCount - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. The count of self joins.
  • protected Illuminate\Database\Eloquent\Builder $query - defined in Illuminate\Database\Eloquent\Relations\Relation. The Eloquent query builder instance.
  • protected Illuminate\Database\Eloquent\Model $parent - defined in Illuminate\Database\Eloquent\Relations\Relation. The parent model instance.
  • protected Illuminate\Database\Eloquent\Model $related - defined in Illuminate\Database\Eloquent\Relations\Relation. The related model instance.
  • protected static bool $constraints - defined in Illuminate\Database\Eloquent\Relations\Relation. Indicates if the relation is adding constraints.
  • protected static array $macros - defined in Illuminate\Database\Eloquent\Relations\Relation. The registered string macros.
  • protected Closure|array|bool $withDefault - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Indicates if a default model instance should be used.

Public methods

public void __construct($query, $child, $foreignKey, $ownerKey, $relationName)
Parameters
  • $query
  • $child
  • $foreignKey
  • $ownerKey
  • $relationName

public void add($model, $sessionKey=NULL)

Adds a model to this relationship type.

Parameters
  • $model
  • $sessionKey

public void addDefinedConstraints()

Set the defined constraints on the relation query.

public void addDefinedConstraintsToQuery(October\Rain\Database\QueryBuilder $query, array $args=NULL)

Add query based constraints.

Parameters

public void addDefinedConstraintsToRelation(Illuminate\Database\Eloquent\Relations\Relation $relation, array $args=NULL)

Add relation based constraints.

Parameters
  • Illuminate\Database\Eloquent\Relations\Relation $relation
  • array $args

public string getOtherKey()

Get the associated key of the relationship.

public void getSimpleValue()

Helper for getting this relationship simple value, generally useful with form values.

public void remove($model, $sessionKey=NULL)

Removes a model from this relationship type.

Parameters
  • $model
  • $sessionKey

public void setSimpleValue($value)

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

Parameters
  • $value

public Illuminate\Database\Query\Builder withDeferred($sessionKey)

Returns the model query with deferred bindings added

Parameters
  • $sessionKey

Show inherited public methods

Inherited public methods

  • public mixed __call(string $method, array $parameters) - defined in Illuminate\Database\Eloquent\Relations\Relation. Handle dynamic method calls to the relationship.
  • public static mixed __callStatic(string $method, array $parameters) - defined in Illuminate\Database\Eloquent\Relations\Relation. Dynamically handle calls to the class.
  • public void __clone() - defined in Illuminate\Database\Eloquent\Relations\Relation. Force a clone of the underlying query builder when cloning.
  • public void addConstraints() - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Set the base constraints on the relation query.
  • public void addEagerConstraints(array $models) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Set the constraints for an eager load of the relation.
  • public Illuminate\Database\Eloquent\Model associate(Illuminate\Database\Eloquent\Model|int|string $model) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Associate the model instance to the given parent.
  • public string createdAt() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the name of the "created at" column.
  • public Illuminate\Database\Eloquent\Model dissociate() - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Dissociate previously associated model from the given parent.
  • public Illuminate\Database\Eloquent\Collection get(array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\Relation. Execute the query as a "select" statement.
  • public Illuminate\Database\Query\Builder getBaseQuery() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the base query builder driving the Eloquent builder.
  • public Illuminate\Database\Eloquent\Collection getEager() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the relationship for eager loading.
  • public string getForeignKey() - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Get the foreign key of the relationship.
  • public static string|null getMorphedModel(string $alias) - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the model associated with a custom polymorphic type.
  • public string getOwnerKey() - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Get the associated key of the relationship.
  • public Illuminate\Database\Eloquent\Model getParent() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the parent model of the relation.
  • public string getQualifiedForeignKey() - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Get the fully qualified foreign key of the relationship.
  • public string getQualifiedOwnerKeyName() - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Get the fully qualified associated key of the relationship.
  • public string getQualifiedParentKeyName() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the fully qualified parent key name.
  • public Illuminate\Database\Eloquent\Builder getQuery() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the underlying query for the relation.
  • public Illuminate\Database\Eloquent\Model getRelated() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the related model of the relation.
  • public string getRelation() - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Get the name of the relationship.
  • public string getRelationCountHash() - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Get a relationship join table hash.
  • public Illuminate\Database\Eloquent\Builder getRelationExistenceCountQuery(Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Builder $parentQuery) - defined in Illuminate\Database\Eloquent\Relations\Relation. Add the constraints for a relationship count query.
  • public Illuminate\Database\Eloquent\Builder getRelationExistenceQuery(Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Builder $parentQuery, array|mixed $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Add the constraints for a relationship query.
  • public Illuminate\Database\Eloquent\Builder getRelationExistenceQueryForSelfRelation(Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Builder $parentQuery, array|mixed $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Add the constraints for a relationship query on the same table.
  • public mixed getResults() - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Get the results of the relationship.
  • public static bool hasMacro(string $name) - defined in Illuminate\Database\Eloquent\Relations\Relation. Checks if macro is registered.
  • public array initRelation(array $models, string $relation) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Initialize the relation on a set of models.
  • public static void macro(string $name, object|callable $macro) - defined in Illuminate\Database\Eloquent\Relations\Relation. Register a custom macro.
  • public mixed macroCall(string $method, array $parameters) - defined in Illuminate\Database\Eloquent\Relations\Relation. Dynamically handle calls to the class.
  • public array match(array $models, Illuminate\Database\Eloquent\Collection $results, string $relation) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Match the eagerly loaded results to their parents.
  • public static void mixin(object $mixin) - defined in Illuminate\Database\Eloquent\Relations\Relation. Mix another object into the class.
  • public static array morphMap(array|null $map=NULL, bool $merge=true) - defined in Illuminate\Database\Eloquent\Relations\Relation. Set or get the morph map for polymorphic relations.
  • public static mixed noConstraints(Closure $callback) - defined in Illuminate\Database\Eloquent\Relations\Relation. Run a callback with constraints disabled on the relation.
  • public int rawUpdate(array $attributes=array()) - defined in Illuminate\Database\Eloquent\Relations\Relation. Run a raw update against the base query.
  • public string relatedUpdatedAt() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the name of the related model's "updated at" column.
  • public void touch() - defined in Illuminate\Database\Eloquent\Relations\Relation. Touch all of the related models for the relationship.
  • public mixed update(array $attributes) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Update the parent model on the relationship.
  • public string updatedAt() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the name of the "updated at" column.
  • public $this withDefault(Closure|array|bool $callback=true) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Return a new model instance in case the relationship does not exist.

Protected methods

protected Illuminate\Database\Query\Expression getWithDeferredQualifiedKeyName()

Returns the related "slave id" key in a database friendly format.

Show inherited protected methods

Inherited protected methods

  • protected static array|null buildMorphMapFromModels(array $models=NULL) - defined in Illuminate\Database\Eloquent\Relations\Relation. Builds a table-keyed array from model class names.
  • protected Illuminate\Database\Eloquent\Model|null getDefaultFor(Illuminate\Database\Eloquent\Model $parent) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Get the default value for this relation.
  • protected array getEagerModelKeys(array $models) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Gather the keys from an array of related models.
  • protected array getKeys(array $models, string $key=NULL) - defined in Illuminate\Database\Eloquent\Relations\Relation. Get all of the primary keys for an array of models.
  • protected Illuminate\Database\Eloquent\Model newRelatedInstanceFor(Illuminate\Database\Eloquent\Model $parent) - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Make a new related instance for the given model.
  • protected bool relationHasIncrementingId() - defined in Illuminate\Database\Eloquent\Relations\BelongsTo. Determine if the related model has an auto-incrementing ID.