October\Rain\Database\Relations\AttachOneOrMany

AttachOneOrMany

Protected properties

protected string $relationName

relationName is the "name" of the relationship

protected boolean $public

public is a default value for file public or protected state

Public methods

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

add a model to this relationship type

Parameters
  • $model
  • $sessionKey

public void addConstraints()

addConstraints sets the field (relation name) constraint on the query

public void addEagerConstraints(array $models)

addEagerConstraints sets the field constraint for an eager load of the relation

Parameters
  • array $models

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

addMany attaches 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()

getForeignKey gets the foreign key for the relationship

public string getOtherKey()

getOtherKey gets 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=>'*'))

getRelationExistenceQuery adds 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=>'*'))

getRelationExistenceQueryForSelfRelation adds 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()

isPublic determines if the file should be flagged "public" or not

public UploadedFile makeValidationFile(mixed $value)

makeValidationFile 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)

remove 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)

isValidFileData returns true if the specified value can be used as the data attribute

Parameters
  • $value