October\Rain\Database\Relations\HasOneOrMany

HasOneOrMany

Protected properties

protected string $relationName

relationName is the "name" of the relationship.

Public methods

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

add a model to this relationship type

Parameters
  • $model
  • $sessionKey

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 with deferred binding support

Parameters
  • $attributes
  • $sessionKey

public string getForeignKey()

getForeignKey for the relationship

public string getOtherKey()

getOtherKey of the relationship

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 with deferred binding support.

Parameters
  • $model
  • $sessionKey

public array saveMany(array $models, $sessionKey=NULL)

saveMany is an alias for the addMany() method

Parameters
  • array $models
  • $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.