Documentation

AttachOneOrMany

Table of Contents

$public  : bool
$relationName  : string
add()  : mixed
Adds a model to this relationship type.
addConstraints()  : void
Set the field (relation name) constraint on the query.
addEagerConstraints()  : void
Set the field constraint for an eager load of the relation.
addMany()  : void
Attach an array of models to the parent instance with deferred binding support.
create()  : mixed
Create a new instance of this related model.
getForeignKey()  : string
Get the foreign key for the relationship.
getOtherKey()  : string
Get the associated "other" key of the relationship.
getRelationExistenceQuery()  : Builder
Add the constraints for a relationship count query.
getRelationExistenceQueryForSelfRelation()  : Builder
Add the constraints for a relationship query on the same table.
isPublic()  : mixed
Determines if the file should be flagged "public" or not.
makeValidationFile()  : 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.
remove()  : mixed
Removes a model from this relationship type.
save()  : mixed
Save the supplied related model.
isValidFileData()  : mixed
Returns true if the specified value can be used as the data attribute.

Properties

$public

protected bool $public

Default value for file public or protected state.

$relationName

protected string $relationName

The "name" of the relationship.

Methods

add()

Adds a model to this relationship type.

public add(Model $model[, mixed $sessionKey = null ]) : mixed
Parameters
$model : Model
$sessionKey : mixed = null
Return values
mixed

addConstraints()

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

public addConstraints() : void
Return values
void

addEagerConstraints()

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

public addEagerConstraints(array<string|int, mixed> $models) : void
Parameters
$models : array<string|int, mixed>
Return values
void

addMany()

Attach an array of models to the parent instance with deferred binding support.

public addMany(array<string|int, mixed> $models[, mixed $sessionKey = null ]) : void
Parameters
$models : array<string|int, mixed>
$sessionKey : mixed = null
Return values
void

create()

Create a new instance of this related model.

public create([array<string|int, mixed> $attributes = [] ][, mixed $sessionKey = null ]) : mixed
Parameters
$attributes : array<string|int, mixed> = []
$sessionKey : mixed = null
Return values
mixed

getForeignKey()

Get the foreign key for the relationship.

public getForeignKey() : string
Return values
string

getOtherKey()

Get the associated "other" key of the relationship.

public getOtherKey() : string
Return values
string

getRelationExistenceQuery()

Add the constraints for a relationship count query.

public getRelationExistenceQuery(Builder $query, Builder $parentQuery[, array<string|int, mixed>|mixed $columns = ['*'] ]) : Builder
Parameters
$query : Builder
$parentQuery : Builder
$columns : array<string|int, mixed>|mixed = ['*']
Return values
Builder

getRelationExistenceQueryForSelfRelation()

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

public getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery[, array<string|int, mixed>|mixed $columns = ['*'] ]) : Builder
Parameters
$query : Builder
$parentQuery : Builder
$columns : array<string|int, mixed>|mixed = ['*']
Return values
Builder

isPublic()

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

public isPublic() : mixed
Return values
mixed

makeValidationFile()

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.

public makeValidationFile(mixed $value) : UploadedFile
Parameters
$value : mixed
Return values
UploadedFile

remove()

Removes a model from this relationship type.

public remove(Model $model[, mixed $sessionKey = null ]) : mixed
Parameters
$model : Model
$sessionKey : mixed = null
Return values
mixed

save()

Save the supplied related model.

public save(Model $model[, mixed $sessionKey = null ]) : mixed
Parameters
$model : Model
$sessionKey : mixed = null
Return values
mixed

isValidFileData()

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

protected isValidFileData(mixed $value) : mixed
Parameters
$value : mixed
Return values
mixed

Search results