HasOne

 class Winter\Storm\Database\Relations\HasOne
extends Illuminate\Database\Eloquent\Relations\HasOne

Traits

Properties

protected $relationName : string

Inherited from HasOneOrMany

The "name" of the relationship.

Methods

public __construct (Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Model $parent, $foreignKey, $localKey, $relationName = null) : void

Create a new "hasOne" relationship.

Parameters
Property Description
$query
Illuminate\Database\Eloquent\Builder
$parent
Illuminate\Database\Eloquent\Model
$foreignKey
mixed
$localKey
mixed
$relationName
mixed
Returns
void

public getSimpleValue ()

Helper for getting this relationship simple value, generally useful with form values.

Returns
mixed

public setSimpleValue ($value)

Helper for setting this relationship using various expected values. For example, $model->relation = $value;

Parameters
Property Description
$value
mixed
Returns
mixed

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

Inherited from HasOneOrMany

Adds a model to this relationship type.

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

public addDefinedConstraints () : void

Inherited from DefinedConstraints

Set the defined constraints on the relation query.

Returns
void

public addDefinedConstraintsToQuery (Illuminate\Database\Eloquent\Relations\Relation | Winter\Storm\Database\QueryBuilder $query, array | null $args = null)

Inherited from DefinedConstraints

Add query based constraints.

Parameters
Property Description
$query
Illuminate\Database\Eloquent\Relations\Relation | Winter\Storm\Database\QueryBuilder
$args
array | null
Returns
mixed

public addDefinedConstraintsToRelation (Illuminate\Database\Eloquent\Relations\Relation $relation, array | null $args = null)

Inherited from DefinedConstraints

Add relation based constraints.

Parameters
Property Description
$relation
Illuminate\Database\Eloquent\Relations\Relation
$args
array | null
Returns
mixed

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

Inherited from HasOneOrMany

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)

Inherited from HasOneOrMany

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

Parameters
Property Description
$attributes
array
$sessionKey
mixed
Returns
mixed

public getForeignKey () : string

Inherited from HasOneOrMany

Get the foreign key for the relationship.

Returns
string

public getOtherKey () : string

Inherited from HasOneOrMany

Get the associated "other" key of the relationship.

Returns
string

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

Inherited from HasOneOrMany

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)

Inherited from HasOneOrMany

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

Inherited from HasOneOrMany

Alias for the addMany() method.

Parameters
Property Description
$models
array
$sessionKey
mixed
Returns
array
Copyright © 2024 Winter CMS