October\Rain\Database\Relations\AttachOneOrMany

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

Protected properties

protected string $relationName

The "name" of the relationship.

protected boolean $public

Default value for file public or protected state.

Public methods

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 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 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 Illuminate\Database\Query\Builder withDeferred($sessionKey)

Returns the model query with deferred bindings added

Parameters
  • $sessionKey

Protected methods

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