October\Rain\Database\Relations\MorphToMany

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

Extends:

Morph to many

This class is a carbon copy of Illuminate\Database\Eloquent\Relations\MorphToMany so the base October\Rain\Database\Relations\BelongsToMany class can be inherited

Public properties

There are no public properties in the class.

Show inherited public properties

Inherited public properties

  • public boolean $countMode - defined in October\Rain\Database\Relations\BelongsToMany. This relation object is a 'count' helper.
  • public boolean $orphanMode - defined in October\Rain\Database\Relations\BelongsToMany. When a join is not used, don't select aliased columns.
  • public bool $withTimestamps - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Indicates if timestamps are available on the pivot table.
  • 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 $morphType

The type of the polymorphic relation.

protected string $morphClass

The class name of the morph type constraint.

protected bool $inverse

Indicates if we are connecting the inverse of the relation.

This primarily affects the morphClass constraint.

Show inherited protected properties

Inherited protected properties

  • protected string $table - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The intermediate table for the relation.
  • protected string $foreignPivotKey - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The foreign key of the parent model.
  • protected string $relatedPivotKey - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The associated key of the relation.
  • protected string $parentKey - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The key name of the parent model.
  • protected string $relatedKey - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The key name of the related model.
  • protected string $relationName - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The "name" of the relationship.
  • protected array $pivotColumns - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The pivot table columns to retrieve.
  • protected array $pivotWheres - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Any pivot table restrictions for where clauses.
  • protected array $pivotWhereIns - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Any pivot table restrictions for whereIn clauses.
  • protected string $pivotCreatedAt - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The custom pivot table column for the created_at timestamp.
  • protected string $pivotUpdatedAt - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The custom pivot table column for the updated_at timestamp.
  • protected string $using - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The class name of the custom pivot model to use for the relationship.
  • protected string $accessor - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. The name of the accessor to use for the "pivot" relationship.
  • protected static int $selfJoinCount - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. 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.

Public methods

public void __construct(Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Model $parent, string $name, string $table, string $foreignKey, string $otherKey, string $relationName, bool $inverse, $relationName=NULL, $inverse=false)

Create a new morph to many relationship instance.

Parameters
  • Illuminate\Database\Eloquent\Builder $query
  • Illuminate\Database\Eloquent\Model $parent
  • string $name
  • string $table
  • string $foreignKey
  • string $otherKey
  • string $relationName
  • bool $inverse
  • $relationName
  • $inverse

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 void addEagerConstraints(array $models)

Set the constraints for an eager load of the relation.

Parameters
  • array $models

public string getMorphClass()

Get the class name of the parent model.

public string getMorphType()

Get the foreign key "type" name.

public Illuminate\Database\Eloquent\Builder getRelationExistenceQuery(Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Builder $parentQuery, array|mixed $columns=array( 0=>'*'))

Add the constraints for a relationship count query.

Parameters
  • Illuminate\Database\Eloquent\Builder $query
  • Illuminate\Database\Eloquent\Builder $parentQuery
  • array|mixed $columns

public Illuminate\Database\Eloquent\Relations\Pivot newPivot(array $attributes=array(), bool $exists=false)

Create a new pivot model instance.

Parameters
  • array $attributes
  • bool $exists

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 add($model, $sessionKey=NULL, $pivotData=array()) - defined in October\Rain\Database\Relations\BelongsToMany. Adds a model to this relationship type.
  • public void addConstraints() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Set the base constraints on the relation query.
  • public October\Rain\Support\Collection allRelatedIds(string $sessionKey=NULL) - defined in October\Rain\Database\Relations\BelongsToMany. Get all of the IDs for the related models, with deferred binding support.
  • public Illuminate\Database\Eloquent\Relations\BelongsToMany as(string $accessor) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Specify the custom pivot accessor to use for the relationship.
  • public void attach(mixed $id, array $attributes=array(), bool $touch=true) - defined in October\Rain\Database\Relations\BelongsToMany. Override attach() method of BelongToMany relation.
  • public bool chunk(int $count, callable $callback) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Chunk the results of the query.
  • public void create($attributes=array(), $pivotData=array(), $sessionKey=NULL) - defined in October\Rain\Database\Relations\BelongsToMany. Create a new instance of this related model with deferred binding support.
  • public array createMany(array $records, array $joinings=array()) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Create an array of new instances of the related models.
  • public string createdAt() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the name of the "created at" column.
  • public int|void detach(null $ids=NULL, bool $touch=true) - defined in October\Rain\Database\Relations\BelongsToMany. Override detach() method of BelongToMany relation.
  • public Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|null find(mixed $id, array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Find a related model by its primary key.
  • public Illuminate\Database\Eloquent\Collection findMany(mixed $ids, array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Find multiple related models by their primary keys.
  • public Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection findOrFail(mixed $id, array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Find a related model by its primary key or throw an exception.
  • public Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model findOrNew(mixed $id, array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Find a related model by its primary key or return new instance of the related model.
  • public mixed first(array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Execute the query and get the first result.
  • public Illuminate\Database\Eloquent\Model firstOrCreate(array $attributes, array $joining=array(), bool $touch=true) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the first related record matching the attributes or create it.
  • public Illuminate\Database\Eloquent\Model|static firstOrFail(array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Execute the query and get the first result or throw an exception.
  • public Illuminate\Database\Eloquent\Model firstOrNew(array $attributes) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the first related model record matching the attributes or instantiate it.
  • public Illuminate\Database\Eloquent\Collection get(array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. 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 getExistenceCompareKey() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the key for comparing against the parent key in "has" query.
  • public string getForeignKey() - defined in October\Rain\Database\Relations\BelongsToMany. Get the fully qualified foreign key for the relation.
  • public string getForeignPivotKeyName() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the foreign key for the relation.
  • 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 getOtherKey() - defined in October\Rain\Database\Relations\BelongsToMany. Get the fully qualified "other key" for the relation.
  • public Illuminate\Database\Eloquent\Model getParent() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the parent model of the relation.
  • public string getPivotAccessor() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the name of the pivot accessor for this relationship.
  • public string getQualifiedForeignPivotKeyName() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the fully qualified foreign key for the relation.
  • public string getQualifiedParentKeyName() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the fully qualified parent key name for the relation.
  • public string getQualifiedRelatedPivotKeyName() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the fully qualified "related key" for the relation.
  • 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 void getRelatedIds($sessionKey=NULL) - defined in October\Rain\Database\Relations\BelongsToMany.
  • public string getRelatedPivotKeyName() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the "related key" for the relation.
  • public string getRelationCountHash() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. 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 getRelationExistenceQueryForSelfJoin(Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Builder $parentQuery, array|mixed $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Add the constraints for a relationship query on the same table.
  • public string getRelationName() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the relationship name for the relationship.
  • public mixed getResults() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the results of the relationship.
  • public void getSimpleValue() - defined in October\Rain\Database\Relations\BelongsToMany. Helper for getting this relationship simple value,
  • public string getTable() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the intermediate table for 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\BelongsToMany. 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\BelongsToMany. 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 Illuminate\Database\Eloquent\Relations\Pivot newExistingPivot(array $attributes=array()) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Create a new existing pivot model instance.
  • public Illuminate\Database\Query\Builder newPivotStatement() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get a new plain query builder for the pivot table.
  • public Illuminate\Database\Query\Builder newPivotStatementForId(mixed $id) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get a new pivot statement for a given "other" ID.
  • public static mixed noConstraints(Closure $callback) - defined in Illuminate\Database\Eloquent\Relations\Relation. Run a callback with constraints disabled on the relation.
  • public Illuminate\Database\Eloquent\Relations\BelongsToMany orWherePivot(string $column, string $operator=NULL, mixed $value=NULL) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Set an "or where" clause for a pivot table column.
  • public Illuminate\Database\Eloquent\Relations\BelongsToMany orWherePivotIn(string $column, mixed $values) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Set an "or where in" clause for a pivot table column.
  • public Illuminate\Contracts\Pagination\LengthAwarePaginator paginate(int $perPage=15, int $currentPage=NULL, array $columns=array( 0=>'*'), string $pageName='page') - defined in October\Rain\Database\Relations\BelongsToMany. Get a paginator for the "select" statement. Complies with October Rain.
  • 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 remove($model, $sessionKey=NULL) - defined in October\Rain\Database\Relations\BelongsToMany. Removes a model from this relationship type.
  • public void save($model, $pivotData=array(), $sessionKey=NULL) - defined in October\Rain\Database\Relations\BelongsToMany. Save the supplied related model with deferred binding support.
  • public array saveMany(Illuminate\Support\Collection|array $models, array $pivotAttributes=array()) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Save an array of new models and attach them to the parent model.
  • public void setSimpleValue($value) - defined in October\Rain\Database\Relations\BelongsToMany. Helper for setting this relationship using various expected.
  • public Illuminate\Contracts\Pagination\Paginator simplePaginate(int $perPage=NULL, array $columns=array( 0=>'*'), string $pageName='page', int|null $page=NULL) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Paginate the given query into a simple paginator.
  • public array sync(Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|array $ids, bool $detaching=true) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Sync the intermediate tables with a list of IDs or collection of models.
  • public array syncWithoutDetaching(Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|array $ids) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Sync the intermediate tables with a list of IDs without detaching.
  • public array toggle(mixed $ids, bool $touch=true) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Toggles a model (or models) from the parent.
  • public void touch() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Touch all of the related models for the relationship.
  • public void touchIfTouching() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. If we're touching the parent model, touch.
  • public int updateExistingPivot(mixed $id, array $attributes, bool $touch=true) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Update an existing pivot record on the table.
  • public Illuminate\Database\Eloquent\Model updateOrCreate(array $attributes, array $values=array(), array $joining=array(), bool $touch=true) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Create or update a related record matching the attributes, and fill it with values.
  • public string updatedAt() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the name of the "updated at" column.
  • public Illuminate\Database\Eloquent\Relations\BelongsToMany using(string $class) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Specify the custom pivot model to use for the relationship.
  • public Illuminate\Database\Eloquent\Relations\BelongsToMany wherePivot(string $column, string $operator=NULL, mixed $value=NULL, string $boolean='and') - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Set a where clause for a pivot table column.
  • public Illuminate\Database\Eloquent\Relations\BelongsToMany wherePivotIn(string $column, mixed $values, string $boolean='and', bool $not=false) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Set a "where in" clause for a pivot table column.
  • public Illuminate\Database\Query\Builder withDeferred($sessionKey) - defined in October\Rain\Database\Relations\BelongsToMany. Returns the model query with deferred bindings added.
  • public $this withPivot(array|mixed $columns) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Set the columns on the pivot table to retrieve.
  • public Illuminate\Database\Eloquent\Relations\BelongsToMany withTimestamps(mixed $createdAt=NULL, mixed $updatedAt=NULL) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Specify that the pivot table has creation and update timestamps.

Protected methods

protected $this addWhereConstraints()

Set the where clause for the relation query.

protected array baseAttachRecord(int $id, bool $timed)

Create a new pivot attachment record.

Parameters
  • int $id
  • bool $timed

protected Illuminate\Database\Query\Builder newPivotQuery()

Create a new query builder for the pivot table.

Show inherited protected methods

Inherited protected methods

  • protected array addTimestampsToAttachment(array $record, bool $exists=false) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Set the creation and update timestamps on an attach record.
  • protected array aliasedPivotColumns() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the pivot columns for the relation.
  • protected array attachNew(array $records, array $current, bool $touch=true) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Attach all of the records that aren't in the given current records.
  • protected array buildDictionary(Illuminate\Database\Eloquent\Collection $results) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Build model dictionary keyed by the relation's foreign key.
  • 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 array castAttributes(array $attributes) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Cast the given pivot attributes.
  • protected mixed castKey(mixed $key) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Cast the given key to an integer if it is numeric.
  • protected array castKeys(array $keys) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Cast the given keys to integers if they are numeric and string otherwise.
  • protected array extractAttachIdAndAttributes(mixed $key, mixed $value, array $attributes) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the attach record ID and extra attributes.
  • protected array formatAttachRecord(int $key, mixed $value, array $attributes, bool $hasTimestamps) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Create a full attachment record payload.
  • protected array formatAttachRecords(array $ids, array $attributes) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Create an array of records to insert into the pivot table.
  • protected array formatRecordsList(array $records) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Format the sync / toggle record list so that it is keyed by ID.
  • 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\Query\Expression getWithDeferredQualifiedKeyName() - defined in October\Rain\Database\Relations\BelongsToMany. Returns the related "slave id" key in a database friendly format.
  • protected string guessInverseRelation() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Attempt to guess the name of the inverse of the relation.
  • protected bool hasPivotColumn(string $column) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Determine whether the given column is defined as a pivot column.
  • protected void hydratePivotRelation(array $models) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Hydrate the pivot table relationship on the models.
  • protected array migratePivotAttributes(Illuminate\Database\Eloquent\Model $model) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get the pivot attributes from a model.
  • protected array parseIds(mixed $value) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Get all of the IDs from the given mixed value.
  • protected $this performJoin(Illuminate\Database\Eloquent\Builder|null $query=NULL) - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Set the join clause for the relation query.
  • protected Illuminate\Database\Eloquent\Relations\BelongsToMany shouldSelect(array $columns=array( 0=>'*')) - defined in October\Rain\Database\Relations\BelongsToMany. Get the select columns for the relation query.
  • protected bool touchingParent() - defined in Illuminate\Database\Eloquent\Relations\BelongsToMany. Determine if we should touch the parent on sync.