AttachOneOrMany

 trait Winter\Storm\Database\Relations\Concerns\AttachOneOrMany

Properties

protected $public : ?bool

Default value for file public or protected state.

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 addConstraints () : void

Set the field (relation name) constraint on the query.

Returns
void

public addEagerConstraints (array $models) : void

Set the field constraint for an eager load of the relation.

Parameters
Property Description
$models
array
Returns
void

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.

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 getRelationExistenceQuery (Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Builder $parentQuery, array $columns = ["*"]) : Illuminate\Database\Eloquent\Builder

Add the constraints for a relationship count query.

Parameters
Property Description
$query
Illuminate\Database\Eloquent\Builder
$parentQuery
Illuminate\Database\Eloquent\Builder
$columns
array
Returns
Illuminate\Database\Eloquent\Builder

public getRelationExistenceQueryForSelfRelation (Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Builder $parentQuery, array $columns = ["*"]) : Illuminate\Database\Eloquent\Builder

Add the constraints for a relationship query on the same table.

Parameters
Property Description
$query
Illuminate\Database\Eloquent\Builder
$parentQuery
Illuminate\Database\Eloquent\Builder
$columns
array
Returns
Illuminate\Database\Eloquent\Builder

public isPublic ()

Determines if the file should be flagged "public" or not.

Returns
mixed

public makeValidationFile (mixed $value) : UploadedFile

Creates a file object suitable for validation, called from the getValidationValue method. Value can be a file model, UploadedFile object (expected) or potentially a string.

Parameters
Property Description
$value
mixed
Returns
UploadedFile

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.

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

protected isValidFileData ($value)

Returns true if the specified value can be used as the data attribute.

Parameters
Property Description
$value
mixed
Returns
mixed

Used by

Class Description
AttachMany
AttachOne
Copyright © 2024 Winter CMS