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 | Type | Description |
---|---|---|
$model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | mixed |
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 | Type | Description |
---|---|---|
$models | array |
array
|
$sessionKey | mixed |
mixed
|
Returns
void
public
create (array $attributes = []
, $sessionKey = null
)
Create a new instance of this related model with deferred binding support.
Parameters
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
$sessionKey | mixed |
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 | Type | Description |
---|---|---|
$model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | mixed |
mixed
|
Returns
mixed
public
save (Illuminate\Database\Eloquent\Model $model, $sessionKey = null
)
Save the supplied related model with deferred binding support.
Parameters
Property | Type | Description |
---|---|---|
$model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | mixed |
mixed
|
Returns
mixed
public
saveMany (array $models, $sessionKey = null
)
: array
Alias for the addMany() method.
Parameters
Property | Type | Description |
---|---|---|
$models | array |
array
|
$sessionKey | mixed |
mixed
|
Returns
array
Used by
← Previous page
Winter\Storm\Database\Relations\Concerns\DefinedConstraints
Next page →
Winter\Storm\Database\Relations\Concerns\MorphOneOrMany
Copyright © 2024 Winter CMS