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.
Property | Type | Description |
---|---|---|
$model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | mixed |
mixed
|
public addConstraints () : void
Set the field (relation name) constraint on the query.
public addEagerConstraints (array $models) : void
Set the field constraint for an eager load of the relation.
Property | Type | Description |
---|---|---|
$models | array |
array
|
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
|
public
create (array $attributes = []
, $sessionKey = null
)
Create a new instance of this related model.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
$sessionKey | mixed |
mixed
|
public getForeignKey () : string
Get the foreign key for the relationship.
public getOtherKey () : string
Get the associated "other" key of the relationship.
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.
Property | Type | Description |
---|---|---|
$query | Illuminate\Database\Eloquent\Builder |
Illuminate\Database\Eloquent\Builder
|
$parentQuery | Illuminate\Database\Eloquent\Builder |
Illuminate\Database\Eloquent\Builder
|
$columns | array |
array
|
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.
Property | Type | Description |
---|---|---|
$query | Illuminate\Database\Eloquent\Builder |
Illuminate\Database\Eloquent\Builder
|
$parentQuery | Illuminate\Database\Eloquent\Builder |
Illuminate\Database\Eloquent\Builder
|
$columns | array |
array
|
public isPublic ()
Determines if the file should be flagged "public" or not.
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.
Property | Type | Description |
---|---|---|
$value | mixed |
mixed
|
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
|
public
save (Illuminate\Database\Eloquent\Model $model, $sessionKey = null
)
Save the supplied related model.
Property | Type | Description |
---|---|---|
$model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
$sessionKey | mixed |
mixed
|
protected isValidFileData ($value)
Returns true if the specified value can be used as the data attribute.
Property | Type | Description |
---|---|---|
$value | mixed |
mixed
|
Used by
Class | Description |
---|---|
AttachMany
|
|
AttachOne
|