October\Rain\Database\Relations\HasOneOrMany

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

Protected properties

protected string $relationName

The "name" of the relationship.

Public methods

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

Adds a model to this relationship type.

Parameters
  • $model
  • $sessionKey

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

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

Parameters
  • $model
  • $sessionKey

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

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.