HasOneOrMany

 trait Winter\Storm\Database\Relations\Concerns\HasOneOrMany

Properties

protected $relationName : string

The "name" of the relationship.

Methods

public add (Illuminate\Database\Eloquent\Model $model, $sessionKey = null)

Adds a model to this relationship type.

Parameters
Property Description
$model
Illuminate\Database\Eloquent\Model
$sessionKey
mixed
Returns
mixed

public addMany (array $models, $sessionKey = null) : void

Attach an array of models to the parent instance with deferred binding support.

Parameters
Property Description
$models
array
$sessionKey
mixed
Returns
void

public create (array $attributes = [], $sessionKey = null)

Create a new instance of this related model with deferred binding support.

Parameters
Property Description
$attributes
array
$sessionKey
mixed
Returns
mixed

public getForeignKey () : string

Get the foreign key for the relationship.

Returns
string

public getOtherKey () : string

Get the associated "other" key of the relationship.

Returns
string

public remove (Illuminate\Database\Eloquent\Model $model, $sessionKey = null)

Removes a model from this relationship type.

Parameters
Property Description
$model
Illuminate\Database\Eloquent\Model
$sessionKey
mixed
Returns
mixed

public save (Illuminate\Database\Eloquent\Model $model, $sessionKey = null)

Save the supplied related model with deferred binding support.

Parameters
Property Description
$model
Illuminate\Database\Eloquent\Model
$sessionKey
mixed
Returns
mixed

public saveMany (array $models, $sessionKey = null) : array

Alias for the addMany() method.

Parameters
Property Description
$models
array
$sessionKey
mixed
Returns
array

Used by

Class Description
HasMany
HasOne
Copyright © 2024 Winter CMS