HasOneOrMany
Table of Contents
- $relationName : string
- add() : mixed
- Adds a model to this relationship type.
- addMany() : void
- Attach an array of models to the parent instance with deferred binding support.
- create() : mixed
- Create a new instance of this related model with deferred binding support.
- getForeignKey() : string
- Get the foreign key for the relationship.
- getOtherKey() : string
- Get the associated "other" key of the relationship.
- remove() : mixed
- Removes a model from this relationship type.
- save() : mixed
- Save the supplied related model with deferred binding support.
- saveMany() : array<string|int, mixed>
- Alias for the addMany() method.
Properties
$relationName
protected
string
$relationName
The "name" of the relationship.
Methods
add()
Adds a model to this relationship type.
public
add(Model $model[, mixed $sessionKey = null ]) : mixed
Parameters
- $model : Model
- $sessionKey : mixed = null
Return values
mixed —addMany()
Attach an array of models to the parent instance with deferred binding support.
public
addMany(array<string|int, mixed> $models[, mixed $sessionKey = null ]) : void
Parameters
- $models : array<string|int, mixed>
- $sessionKey : mixed = null
Return values
void —create()
Create a new instance of this related model with deferred binding support.
public
create([array<string|int, mixed> $attributes = [] ][, mixed $sessionKey = null ]) : mixed
Parameters
- $attributes : array<string|int, mixed> = []
- $sessionKey : mixed = null
Return values
mixed —getForeignKey()
Get the foreign key for the relationship.
public
getForeignKey() : string
Return values
string —getOtherKey()
Get the associated "other" key of the relationship.
public
getOtherKey() : string
Return values
string —remove()
Removes a model from this relationship type.
public
remove(Model $model[, mixed $sessionKey = null ]) : mixed
Parameters
- $model : Model
- $sessionKey : mixed = null
Return values
mixed —save()
Save the supplied related model with deferred binding support.
public
save(Model $model[, mixed $sessionKey = null ]) : mixed
Parameters
- $model : Model
- $sessionKey : mixed = null
Return values
mixed —saveMany()
Alias for the addMany() method.
public
saveMany(array<string|int, mixed> $models[, mixed $sessionKey = null ]) : array<string|int, mixed>
Parameters
- $models : array<string|int, mixed>
- $sessionKey : mixed = null