AttachOne

 class Winter\Storm\Database\Relations\AttachOne
extends Illuminate\Database\Eloquent\Relations\MorphOne

Traits

Properties

protected $public : ?bool

Inherited from AttachOneOrMany

Default value for file public or protected state.

protected $relationName : string

Inherited from AttachOneOrMany

The "name" of the relationship.

Methods

public __construct (Illuminate\Database\Eloquent\Builder $query, Illuminate\Database\Eloquent\Model $parent, string $type, string $id, bool $isPublic, string $localKey, null | string $relationName = null)

Create a new has many relationship instance.

Parameters
Property Description
$query
Illuminate\Database\Eloquent\Builder
$parent
Illuminate\Database\Eloquent\Model
$type
string
$id
string
$isPublic
bool
$localKey
string
$relationName
null | string
Returns
mixed

public getSimpleValue ()

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

Returns
mixed

public getValidationValue ()

Helper for getting this relationship validation value.

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

protected getSimpleValueInternal ()

Internal method used by getSimpleValue and getValidationValue

Returns
mixed

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

Inherited from AttachOneOrMany

Adds a model to this relationship type.

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

public addConstraints () : void

Inherited from AttachOneOrMany

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

Returns
void

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 addEagerConstraints (array $models) : void

Inherited from AttachOneOrMany

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

Inherited from AttachOneOrMany

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 AttachOneOrMany

Create a new instance of this related model.

Parameters
Property Description
$attributes
array
$sessionKey
mixed
Returns
mixed

public getForeignKey () : string

Inherited from AttachOneOrMany

Get the foreign key for the relationship.

Returns
string

public getOtherKey () : string

Inherited from AttachOneOrMany

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

Inherited from AttachOneOrMany

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

Inherited from AttachOneOrMany

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 ()

Inherited from AttachOneOrMany

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

Returns
mixed

public makeValidationFile (mixed $value) : UploadedFile

Inherited from AttachOneOrMany

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)

Inherited from AttachOneOrMany

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 AttachOneOrMany

Save the supplied related model.

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

protected isValidFileData ($value)

Inherited from AttachOneOrMany

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

Parameters
Property Description
$value
mixed
Returns
mixed
Copyright © 2023 Winter CMS