October\Rain\Database\Relations\AttachMany

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

Extends:

  • Illuminate\Database\Eloquent\Relations\MorphMany
  • Illuminate\Database\Eloquent\Relations\MorphOneOrMany
  • Illuminate\Database\Eloquent\Relations\HasOneOrMany
  • 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.

protected boolean $public

Default value for file public or protected state.

Show inherited protected properties

Inherited protected properties

  • protected string $morphType - defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany. The foreign key type for the relationship.
  • protected string $morphClass - defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany. The class name of the parent model.
  • protected string $foreignKey - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. The foreign key of the parent model.
  • protected string $localKey - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. The local key of the parent model.
  • protected static int $selfJoinCount - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. 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($query, $parent, $type, $id, $isPublic, $localKey, $relationName=NULL)

Create a new has many relationship instance.

Parameters
  • $query
  • $parent
  • $type
  • $id
  • $isPublic
  • $localKey
  • $relationName

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

Adds a model to this relationship type.

Parameters
  • $model
  • $sessionKey

public void addConstraints()

Set the field (relation name) constraint on the query.

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 field constraint for an eager load of the relation.

Parameters
  • array $models

public void addMany(array $models, $sessionKey=NULL)

Attach an array of models to the parent instance with deferred binding support.

Parameters
  • array $models
  • $sessionKey

public void create($attributes=array(), $sessionKey=NULL)

Create a new instance of this related model.

Parameters
  • $attributes
  • $sessionKey

public string getForeignKey()

Get the foreign key for the relationship.

public string getOtherKey()

Get the associated "other" key of the relationship.

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\Builder getRelationExistenceQueryForSelfRelation(Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Builder $parentQuery, array|mixed $columns=array( 0=>'*'))

Add the constraints for a relationship query on the same table.

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

public void getSimpleValue()

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

public void getValidationValue()

Helper for getting this relationship validation value.

public void isPublic()

Determines if the file should be flagged "public" or not.

public UploadedFile makeValidationFile(mixed $value)

Creates a file object suitable for validation, called from the getValidationValue method. Value can be a file model, UploadedFile object (expected) or potentially a string.

Parameters
  • mixed $value

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

Removes a model from this relationship type.

Parameters
  • $model
  • $sessionKey

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

Save the supplied related model.

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 Illuminate\Database\Eloquent\Collection createMany(array $records) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Create a Collection of new instances of the related model.
  • public string createdAt() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the name of the "created at" column.
  • public Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model findOrNew(mixed $id, array $columns=array( 0=>'*')) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Find a model by its primary key or return new instance of the related model.
  • public Illuminate\Database\Eloquent\Model firstOrCreate(array $attributes, array $values=array()) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Get the first related record matching the attributes or create it.
  • public Illuminate\Database\Eloquent\Model firstOrNew(array $attributes, array $values=array()) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. 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\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 getExistenceCompareKey() - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Get the key for comparing against the parent key in "has" query.
  • public string getForeignKeyName() - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Get the plain foreign key.
  • public string getMorphClass() - defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany. Get the class name of the parent model.
  • public string getMorphType() - defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany. Get the plain morph type name without the table.
  • public static string|null getMorphedModel(string $alias) - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the model associated with a custom polymorphic type.
  • public Illuminate\Database\Eloquent\Model getParent() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the parent model of the relation.
  • public mixed getParentKey() - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Get the key value of the parent's local key.
  • public string getQualifiedForeignKeyName() - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Get the foreign key for the relationship.
  • public string getQualifiedMorphType() - defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany. Get the foreign key "type" name.
  • public string getQualifiedParentKeyName() - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. 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 getRelationCountHash() - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. 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 mixed getResults() - defined in Illuminate\Database\Eloquent\Relations\MorphMany. 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\MorphMany. 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 Illuminate\Database\Eloquent\Model make(array $attributes=array()) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Create and return an un-saved instance of the related model.
  • public array match(array $models, Illuminate\Database\Eloquent\Collection $results, string $relation) - defined in Illuminate\Database\Eloquent\Relations\MorphMany. Match the eagerly loaded results to their parents.
  • public array matchMany(array $models, Illuminate\Database\Eloquent\Collection $results, string $relation) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Match the eagerly loaded results to their many parents.
  • public array matchOne(array $models, Illuminate\Database\Eloquent\Collection $results, string $relation) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Match the eagerly loaded results to their single 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 Traversable|array saveMany(Traversable|array $models) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Attach a collection of models to the parent instance.
  • public void touch() - defined in Illuminate\Database\Eloquent\Relations\Relation. Touch all of the related models for the relationship.
  • public int update(array $attributes) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Perform an update on all the related models.
  • public Illuminate\Database\Eloquent\Model updateOrCreate(array $attributes, array $values=array()) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Create or update a related record matching the attributes, and fill it with values.
  • public string updatedAt() - defined in Illuminate\Database\Eloquent\Relations\Relation. Get the name of the "updated at" column.

Protected methods

protected void getSimpleValueInternal()

Internal method used by getSimpleValue and getValidationValue

protected Illuminate\Database\Query\Expression getWithDeferredQualifiedKeyName()

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

protected void isValidFileData($value)

Returns true if the specified value can be used as the data attribute.

Parameters
  • $value

Show inherited protected methods

Inherited protected methods

  • protected array buildDictionary(Illuminate\Database\Eloquent\Collection $results) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. 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 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 mixed getRelationValue(array $dictionary, string $key, string $type) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Get the value of a relationship by one or many type.
  • protected array matchOneOrMany(array $models, Illuminate\Database\Eloquent\Collection $results, string $relation, string $type) - defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany. Match the eagerly loaded results to their many parents.
  • protected void setForeignAttributesForCreate(Illuminate\Database\Eloquent\Model $model) - defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany. Set the foreign ID and type for creating a related model.