HasOne
class Winter\Storm\Database\Relations\HasOne
extends Illuminate\Database\Eloquent\Relations\HasOne
Extends
Class | Description |
---|---|
Illuminate\Database\Eloquent\Relations\HasOne
|
Traits
Trait | Description |
---|---|
DefinedConstraints
|
|
HasOneOrMany
|
Properties
inherited protected $relationName : string
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.
Property | Type | Description |
---|---|---|
$query | Illuminate\Database\Eloquent\Builder |
Illuminate\Database\Eloquent\Builder
|
$parent | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$foreignKey | mixed |
mixed
|
$localKey | mixed |
mixed
|
$relationName | mixed |
mixed
|
public getSimpleValue ()
Helper for getting this relationship simple value, generally useful with form values.
public setSimpleValue ($value)
Helper for setting this relationship using various expected values. For example, $model->relation = $value;
Property | Type | Description |
---|---|---|
$value | mixed |
mixed
|
inherited
public
add (Illuminate\Database\Eloquent\Model $model, $sessionKey = null
)
Adds a model to this relationship type.
Property | Type | Description |
---|---|---|
$model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | mixed |
mixed
|
inherited public addDefinedConstraints () : void
Set the defined constraints on the relation query.
inherited
public
addDefinedConstraintsToQuery (Illuminate\Database\Eloquent\Relations\Relation | Winter\Storm\Database\QueryBuilder $query, array | null $args = null
)
Add query based constraints.
Property | Type | Description |
---|---|---|
$query | Illuminate\Database\Eloquent\Relations\Relation | Winter\Storm\Database\QueryBuilder |
Illuminate\Database\Eloquent\Relations\Relation | Winter\Storm\Database\QueryBuilder
|
$args | array | null |
array | null
|
inherited
public
addDefinedConstraintsToRelation (Illuminate\Database\Eloquent\Relations\Relation $relation, array | null $args = null
)
Add relation based constraints.
Property | Type | Description |
---|---|---|
$relation | Illuminate\Database\Eloquent\Relations\Relation |
Illuminate\Database\Eloquent\Relations\Relation
|
$args | array | null |
array | null
|
inherited
public
addMany (array $models, $sessionKey = null
)
: void
Attach an array of models to the parent instance with deferred binding support.
Property | Type | Description |
---|---|---|
$models | array |
array
|
$sessionKey | mixed |
mixed
|
inherited
public
create (array $attributes = []
, $sessionKey = null
)
Create a new instance of this related model with deferred binding support.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
$sessionKey | mixed |
mixed
|
inherited public getForeignKey () : string
Get the foreign key for the relationship.
inherited public getOtherKey () : string
Get the associated "other" key of the relationship.
inherited
public
remove (Illuminate\Database\Eloquent\Model $model, $sessionKey = null
)
Removes a model from this relationship type.
Property | Type | Description |
---|---|---|
$model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | mixed |
mixed
|
inherited
public
save (Illuminate\Database\Eloquent\Model $model, $sessionKey = null
)
Save the supplied related model with deferred binding support.
Property | Type | Description |
---|---|---|
$model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | mixed |
mixed
|
inherited
public
saveMany (array $models, $sessionKey = null
)
: array
Alias for the addMany() method.
Property | Type | Description |
---|---|---|
$models | array |
array
|
$sessionKey | mixed |
mixed
|