October\Rain\Database\Relations\TranslatableAttachOne
Overview
TranslatableAttachOne is an attachOne relation that stores its file per locale.
Extends
- October\Rain\Database\Relations\AttachOne
- Illuminate\Database\Eloquent\Relations\MorphOne
- Illuminate\Database\Eloquent\Relations\MorphOneOrMany
- Illuminate\Database\Eloquent\Relations\HasOneOrMany
- Illuminate\Database\Eloquent\Relations\Relation
Implements
- Illuminate\Contracts\Database\Eloquent\Builder
- Illuminate\Contracts\Database\Query\Builder
- Illuminate\Contracts\Database\Eloquent\SupportsPartialRelations
Public Properties
There are no public properties in the class.
Show inherited public properties
Inherited Public Properties
- $morphMap - An array to map morph names to their class names in the database. (defined in Illuminate\Database\Eloquent\Relations\Relation)
Protected Properties
protected string|null $attachmentLocale
attachmentLocale suffixes the field column, null for the default locale.
protected bool $useFallback
useFallback reads the default locale files when the locale has none of its own.
Show inherited protected properties
Inherited Protected Properties
- $morphType - The foreign key type for the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- $morphClass - The morph class of the parent model. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- $foreignKey - The foreign key of the parent model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- $localKey - The local key of the parent model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- $query - The Eloquent query builder instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $parent - The parent model instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $related - The related model instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $eagerKeysWereEmpty - Indicates whether the eagerly loaded relation should implicitly return an empty collection. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $constraints - Indicates if the relation is adding constraints. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $constraintsForNestedRelations - Indicates whether constraints should be enabled for nested relation attributes. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $requireMorphMap - Prevents morph relationships without a morph map. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $selfJoinCount - The count of self joins. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $macros - The registered string macros. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $inverseRelationship - The name of the inverse relationship. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- $isOneOfMany - Determines whether the relationship is one-of-many. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- $relationName - The name of the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- $oneOfManySubQuery - The one of many inner join subselect query builder instance. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- $withDefault - Indicates if a default model instance should be used. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- $public - is a default value for file public or protected state. (defined in October\Rain\Database\Relations\AttachOne)
- $pivotSiteScope - indicates if pivot queries should be scoped by site_id. (defined in October\Rain\Database\Relations\AttachOne)
Public Methods
public __construct()
public __construct(
$query,
$parent,
$type,
$id,
$isPublic,
$localKey,
$relationName = null
): void
__construct resolves the locale from the parent model before the constraints are added.
public addEagerConstraints()
public addEagerConstraints($models): void
addEagerConstraints resolves the fallback per parent model for an eager load.
public getAttachmentField()
public getAttachmentField(): string
getAttachmentField returns the relation name with a locale suffix for non-default locales.
public getAttachmentLocale()
public getAttachmentLocale(): string|null
getAttachmentLocale returns the locale this relation stores files under, or null for the default locale.
public getRelationExistenceQuery()
public getRelationExistenceQuery(
$query,
$parentQuery,
$columns = [ 0 => '*']
): void
getRelationExistenceQuery resolves the fallback for has and count queries.
public getResults()
public getResults(): void
getResults reads the locale files, or the default locale files when the locale has none.
public newAttachmentQuery()
public newAttachmentQuery(): void
newAttachmentQuery returns a query for the parent's files of this relation in every locale.
public remove()
public remove($model, $sessionKey = null): void
remove clears the loaded relation so the next read can fall back to the default locale files.
public setSimpleValue()
public setSimpleValue($value): void
setSimpleValue clears the loaded relation when emptied so reads fall back to the default locale files.
public usesFallback()
public usesFallback(): bool
usesFallback returns true when reads resolve to the default locale files for a locale without its own.
public withoutFallback()
public withoutFallback(): void
withoutFallback reads only the files stored under the active locale.
Inherited Public Methods
- __call() - Handle dynamic method calls to the relationship. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- __callStatic() - Dynamically handle calls to the class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- __clone() - Force a clone of the underlying query builder when cloning. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- add() - a model to this relationship type. (defined in October\Rain\Database\Relations\AttachOne)
- addCommonEagerConstraints() - adds constraints without the field constraint, used to. (defined in October\Rain\Database\Relations\AttachOne)
- addConstraints() - sets the field (relation name) constraint on the query. (defined in October\Rain\Database\Relations\AttachOne)
- addDefinedConstraints() - to the relation query. (defined in October\Rain\Database\Relations\AttachOne)
- addDefinedConstraintsToQuery() - (defined in October\Rain\Database\Relations\AttachOne)
- addDefinedConstraintsToRelation() - (defined in October\Rain\Database\Relations\AttachOne)
- addMany() - attaches an array of models to the parent instance with deferred binding support. (defined in October\Rain\Database\Relations\AttachOne)
- addOneOfManyJoinSubQueryConstraints() - Add join query constraints for one of many relationships. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- addOneOfManySubQueryConstraints() - Add constraints for inner join subselect for one of many relationships. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- chaperone() - Instruct Eloquent to link the related models back to the parent after the relationship query has run. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- create() - a new instance of this related model. (defined in October\Rain\Database\Relations\AttachOne)
- createFromFile() - (defined in October\Rain\Database\Relations\AttachOne)
- createMany() - creates multiple instances of related models. (defined in October\Rain\Database\Relations\AttachOne)
- createManyQuietly() - creates multiple instances without raising any events. (defined in October\Rain\Database\Relations\AttachOne)
- createOrFirst() - Attempt to create the record. If a unique constraint violation occurs, attempt to find the matching record. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- createQuietly() - creates a new instance without raising any events. (defined in October\Rain\Database\Relations\AttachOne)
- createdAt() - Get the name of the "created at" column. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- enforceMorphMap() - Define the morph map for polymorphic relations and require all morphed models to be explicitly mapped. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- findOrNew() - Find a model by its primary key or return a new instance of the related model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- firstOrCreate() - Get the first record matching the attributes. If the record is not found, create it. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- firstOrNew() - Get the first related model record matching the attributes or instantiate it. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- flushMacros() - Flush the existing macros. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- forceCreate() - Create a new instance of the related model. Allow mass-assignment. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- forceCreateMany() - Create a Collection of new instances of the related model, allowing mass-assignment. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- forceCreateManyQuietly() - Create a Collection of new instances of the related model, allowing mass-assignment and without raising any events to the parent model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- forceCreateQuietly() - Create a new instance of the related model with mass assignment without raising model events. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- get() - Execute the query as a "select" statement. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getBaseQuery() - Get the base query builder driving the Eloquent builder. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getEager() - Get the relationship for eager loading. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getExistenceCompareKey() - Get the key for comparing against the parent key in "has" query. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getForeignKey() - (defined in October\Rain\Database\Relations\AttachOne)
- getForeignKeyName() - Get the plain foreign key. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getInverseRelationship() - Get the name of the inverse relationship. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getLocalKeyName() - Get the local key for the relationship. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getMorphAlias() - Get the alias associated with a custom polymorphic class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getMorphClass() - Get the morph class of the parent model. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- getMorphType() - Get the plain morph type name without the table. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- getMorphedModel() - Get the model associated with a custom polymorphic type. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getOneOfManySubQuery() - Get the one of many inner join subselect builder instance. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- getOneOfManySubQuerySelectColumns() - Get the columns that should be selected by the one of many subquery. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- getOtherKey() - (defined in October\Rain\Database\Relations\AttachOne)
- getParent() - Get the parent model of the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getParentKey() - Get the key value of the parent's local key. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getQualifiedForeignKeyName() - Get the foreign key for the relationship. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getQualifiedMorphType() - Get the foreign key "type" name. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- getQualifiedParentKeyName() - Get the fully-qualified parent key name. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getQuery() - Get the underlying query for the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelated() - Get the related model of the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelatedClass() - Get the class name of the related model. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelatedKeyName() - (defined in October\Rain\Database\Relations\AttachOne)
- getRelationCountHash() - Get a relationship join table hash. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelationExistenceCountQuery() - Add the constraints for a relationship count query. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelationExistenceQueryForSelfRelation() - adds the constraints for a relationship query on the same table. (defined in October\Rain\Database\Relations\AttachOne)
- getRelationName() - Get the name of the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- getSimpleValue() - helper for getting this relationship simple value, (defined in October\Rain\Database\Relations\AttachOne)
- hasMacro() - Checks if macro is registered. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- incrementOrCreate() - Create a related record matching the attributes, or increment the existing record. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- initRelation() - (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- inverse() - Instruct Eloquent to link the related models back to the parent after the relationship query has run. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- is() - Determine if the model is the related instance of the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- isNot() - Determine if the model is not the related instance of the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- isOneOfMany() - Determine whether the relationship is a one-of-many relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- isPivotSiteScoped() - returns true if pivot queries should be scoped by site_id. (defined in October\Rain\Database\Relations\AttachOne)
- isPublic() - determines if the file should be flagged "public" or not. (defined in October\Rain\Database\Relations\AttachOne)
- latestOfMany() - Indicate that the relation is the latest single result of a larger one-to-many relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- limit() - Set the "limit" value of the query. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- macro() - Register a custom macro. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- macroCall() - Dynamically handle calls to the class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- make() - Create and return an un-saved instance of the related model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- makeMany() - Create and return an un-saved instance of the related models. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- makeValidationFile() - (defined in October\Rain\Database\Relations\AttachOne)
- match() - (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- matchMany() - Match the eagerly loaded results to their many parents. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- matchOne() - Match the eagerly loaded results to their single parents. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- mixin() - Mix another object into the class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- morphMap() - Set or get the morph map for polymorphic relations. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- newRelatedInstanceFor() - Make a new related instance for the given model. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- noConstraints() - Run a callback with constraints disabled on the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- noConstraintsForRelation() - Run a callback without constraints while preserving them for nested relation attributes. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- ofMany() - Indicate that the relation is a single result of a larger one-to-many relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- oldestOfMany() - Indicate that the relation is the oldest single result of a larger one-to-many relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- qualifySubSelectColumn() - Get the qualified column name for the one-of-many relationship using the subselect join query's alias. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- rawUpdate() - Run a raw update against the base query. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- relatedUpdatedAt() - Get the name of the related model's "updated at" column. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- requireMorphMap() - Prevent polymorphic relationships from being used without model mappings. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- requiresMorphMap() - Determine if polymorphic relationships require explicit model mapping. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- save() - the supplied related model. (defined in October\Rain\Database\Relations\AttachOne)
- saveMany() - saves multiple models with deferred binding support. (defined in October\Rain\Database\Relations\AttachOne)
- saveManyQuietly() - saves multiple models without raising any events. (defined in October\Rain\Database\Relations\AttachOne)
- saveQuietly() - saves the supplied related model without raising any events. (defined in October\Rain\Database\Relations\AttachOne)
- sole() - Execute the query and get the first result if it's the sole matching record. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- take() - Alias to set the "limit" value of the query. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- toBase() - Get a base query builder instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- touch() - Touch all of the related models for the relationship. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- updateOrCreate() - Create or update a related record matching the attributes, and fill it with values. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- updatedAt() - Get the name of the "updated at" column. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- upsert() - Insert new records or update the existing ones. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- withConstraints() - Run a callback with constraints enabled on the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- withConstraintsForNestedRelation() - Run a callback with constraints when resolving a nested relation attribute. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- withDefault() - Return a new model instance in case the relationship does not exist. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- withDeferred() - returns a new model query with deferred bindings added, this. (defined in October\Rain\Database\Relations\AttachOne)
- withDeferredQuery() - returns the supplied model query, or current model query, with. (defined in October\Rain\Database\Relations\AttachOne)
- withoutChaperone() - Remove the chaperone / inverse relationship for this query. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- withoutInverse() - Remove the chaperone / inverse relationship for this query. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
Protected Methods
protected addResolvedFieldConstraint()
protected addResolvedFieldConstraint($query): void
addResolvedFieldConstraint matches the locale field, or the default field when the parent has no locale files.
protected resolveAttachmentLocale()
protected resolveAttachmentLocale($parent): string|null
resolveAttachmentLocale returns the active locale when it differs from the default locale.
Show inherited protected methods
Inherited Protected Methods
- addOneOfManyJoinSubQuery() - Add the join subquery to the given query on the given column and the relationship's foreign key. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- addPivotSiteScopeConstraints() - adds site_id constraint to pivot queries if enabled. (defined in October\Rain\Database\Relations\AttachOne)
- applyInverseRelationToCollection() - Set the inverse relation on all models in a collection. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- applyInverseRelationToModel() - Set the inverse relation on a model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- buildDictionary() - Build model dictionary keyed by the relation's foreign key. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- buildMorphMapFromModels() - Builds a table-keyed array from model class names. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- compareKeys() - Compare the parent key with the related key. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- ensureAttachOneIsSingular() - ensures AttachOne only has one attachment, (defined in October\Rain\Database\Relations\AttachOne)
- ensureRelationIsEmpty() - ensures the relation is empty, either deleted or nulled. (defined in October\Rain\Database\Relations\AttachOne)
- forwardCallTo() - Forward a method call to the given object. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- forwardDecoratedCallTo() - Forward a method call to the given object, returning $this if the forwarded call returned itself. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getDefaultFor() - Get the default value for this relation. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- getDefaultOneOfManyJoinAlias() - Get the default alias for the one of many inner join clause. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- getDictionaryKey() - Get a dictionary key attribute - casting it to a string if necessary. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getKeys() - Get all of the primary keys for an array of models. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getPivotSiteScopeValue() - returns the current site_id value for pivot records. (defined in October\Rain\Database\Relations\AttachOne)
- getPossibleInverseRelations() - Get the possible inverse relations for the parent model. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- getRelatedKeyFrom() - Get the value of the model's foreign key. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- getRelationDefinitionForDefinedConstraints() - returns the relation definition for the. (defined in October\Rain\Database\Relations\AttachOne)
- getRelationQuery() - Get the query builder that will contain the relationship constraints. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- getRelationValue() - Get the value of a relationship by one or many type. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getWithDeferredQualifiedKeyName() - returns the related "slave id" key. (defined in October\Rain\Database\Relations\AttachOne)
- guessInverseRelation() - Guess the name of the inverse relationship. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- guessRelationship() - Guess the "hasOne" relationship's name via backtrace. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- isModelRemovable() - returns true if an existing model is already associated. (defined in October\Rain\Database\Relations\AttachOne)
- matchOneOrMany() - Match the eagerly loaded results to their many parents. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- mergeOneOfManyJoinsTo() - Merge the relationship query joins to the given query builder. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- newOneOfManySubQuery() - Get a new query for the related model, grouping the query by the given column, often the foreign key of the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- qualifyRelatedColumn() - Qualify related column using the related table name if it is not already qualified. (defined in Illuminate\Database\Eloquent\Relations\MorphOne)
- setForeignAttributesForCreate() - Set the foreign ID and type for creating a related model. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- throwBadMethodCallException() - Throw a bad method call exception for the given method. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- whereInEager() - Add a whereIn eager constraint for the given set of model keys to be loaded. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- whereInMethod() - Get the name of the "where in" method for eager loading. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- withoutConstraints() - Run a callback with the configured relation constraints. (defined in Illuminate\Database\Eloquent\Relations\Relation)