Protected
attributeProtected
attributesThe attributes.
Protected
fillableThe attributes that are mass assignable.
Protected
guardedThe attributes that aren't mass assignable
Protected
hasThe key name of the parent of this model which was
instantiated from a hasOne or hasMany relation.
This is used to remove the where query when saving
a new entity like parent.$child().save({});
Protected
mutatedThe endpoint used when querying the api.
Protected
originalThe attribute's original state.
Protected
queryProtected
relationsThe loaded relations for the model. The keys do not include the relation prefixes.
Protected
Readonly
softIndicates if the model should expect a timestamp for soft-deletion.
Protected
Readonly
timestampsIndicates if the model should expect timestamps.
Protected
withThe relations that should be included on every request.
Static
Protected
Readonly
createdThe name of the created at attribute on the server side.
Static
Protected
Readonly
deletedThe name of the deleted at attribute on the server side.
Static
Protected
Readonly
updatedThe name of the updated at attribute on the server side.
Protected
attributeProperty indicating how attributes and relation names should be cast by default.
Protected
The attributes that should be cast.
Protected
endpointProtected
The basic endpoint that model queries.
Indicates whether the model exists on the backend or not.
The attributes that are mass assignable.
The attributes that are not mass assignable.
Protected
keyProtected
The type of the key that acts as the primary key of the model.
Boolean flag indicating whether there is an ongoing request or not.
Protected
primaryProtected
The primary key for the model.
Protected
relationProtected
The string all the relation methods expected to prefixed by.
Protected
serverProtected
Property indicating how attributes and relation names should be cast by default when sent to the server.
Parse the given data into a related model class and add the relation to this instance.
this
Protected
addSet the endpoint on the correct model for querying.
Optional
foreignKey: stringSet the endpoint on the correct model for querying.
Optional
relationName: stringThe name of the relation on the backend.
Protected
callProtected
The call method that mediates between the model and api handlers.
Optional
data: Partial<{ Optional
customHeaders: CustomHeadersOptional
data: FormData | SimpleAttributes | SimpleAttributes<Model>Optional
customHeaders: CustomHeadersProtected
castProtected
Internal
Cast the attribute to the specified type.
The method to use when interacting with the AttributeCaster.
Protected
compileProtected
Compiles the query parameters into a single object.
Protected
createCreate descriptors for the given key(s) therefore allowing magic access.
Delete the model.
Optional
data: FormData | SimpleAttributes | SimpleAttributes<Model>Request only distinct values on the query based on the given columns.
Get all model attributes except the given keys.
Fill the model with the given attributes while respecting the guarding settings.
Set the endpoint to a nested url structure.
this
Fill the model with the given attributes without respecting the guarding settings.
Send a GET request to the endpoint.
Optional
queryParameters: Partial<{ append and/or overwrite query parameter values.
Get an attribute from the model.
Optional
defaultValue: TGet all the attributes on the model.
Protected
getGet the attributes that were changed.
Optional
key: stringGet the deleted attributes if any.
Optional
key: stringProtected
getGet the fillable attributes from the given object.
Protected
getGets the current class' name.
For more information check the https://upfrontjs.com/calliope/#getname|documentation
Get the new attributes if any.
Optional
key: stringGet the original attributes.
Optional
defaultValue: TGet all the attributes on the model without casting or accessors.
Get the original attributes without casting.
Optional
defaultValue: TGet the specified relationship.
Protected
getGet all the relations.
Add a has check of the related records
Protected
hasSet the endpoint on the correct model for querying.
Set the endpoint on the correct model for querying.
Protected
hasProtected
implementsProtected
Determine whether the given value implements casting.
Determine if two models have the same key and of the same type.
Determine if two models are not the same.
Model.prototype.is
Load a relationships from remote.
Whether the already loaded relations should also be reloaded.
Set the endpoint on the correct model for querying.
Optional
morphName: stringSet the endpoint on the correct model for querying.
Optional
morphName: stringAdd a constraint for the next query to return all relation.
public $contractable(): this {
return this.morphTo<Team | User>((self, _data) => {
return self.contractableType === 'team' ? Team : User;
});
}
Callback that returns a model that this morphs to.
Optional
relationName: stringThe name of the relation to be called. E.g.: 'commentable'
Construct a new model from context.
Optional
attributes: Model | Attributes<Model>Protected
newProtected
Parse the data into a model or model collection.
Get a subset of the model's attributes.
Add an or where key closure to the query.
Add a where key not closure to the query.
Add an or where not null closure to the query.
Add an or where null closure to the query.
Send a PATCH request to the endpoint.
@ts-expect-error - despite TS2526, it still infers correctly
Send a POST request to the endpoint.
@ts-expect-error - despite TS2526, it still infers correctly
Send a PUT request to the endpoint.
@ts-expect-error - despite TS2526, it still infers correctly
Protected
relationClone the model into a non-exiting instance.
Optional
except: MaybeArray<string>Protected
resetSave or update the model.
Optional
data: SimpleAttributes<Model>Add eager loaded relations to the query.
Tell the api which columns are required.
Set a given attribute on the model.
Protected
setProtected
setProtected
setSync the original attributes with the current.
Optional
keys: MaybeArray<string>Protected
throwSet the correct endpoint and initiate a patch request.
CallsApi.prototype.patch
Add a where constraint to the query.
Optional
value: unknownOptional
boolean: BooleanOperatorAdd a where key closure to the query.
Add a where key not closure to the query.
Add a where not null closure to the query.
Add a where null closure to the query.
Add eager loaded relations to the query.
Remove eager loaded relations from the query.
Static
allGet all the models.
Static
distinctThe static version of the distinct method.
BuildsQuery.prototype.distinct
Static
factoryCall the factory fluently from the model.
Static
findFind the model based on the given id.
Static
findReturn multiple models based on the given ids.
Static
getThe get method made available as a static method.
CallsApi.prototype.get
Optional
queryParameters: Partial<{ append and/or overwrite query parameter values.
Static
hasThe static version of the has method.
BuildsQuery.prototype.has
Static
latestStatic
limitStatic
makeConstruct a new model instance.
Optional
attributes: Attributes<T>Static
newStatic
offsetStatic
oldestStatic
orderStatic
orderStatic
pageStatic
scopeThe static version of the scope method.
BuildsQuery.prototype.scope
Static
selectThe static version of the select method.
BuildsQuery.prototype.select
Static
skipStatic
whereThe static version of the where method.
BuildsQuery.prototype.where
Optional
boolean: BooleanOperatorStatic
whereStatic
whereStatic
whereThe static version of the whereKey method.
BuildsQuery.prototype.whereKey
Static
whereThe static version of the whereKeyNot method.
BuildsQuery.prototype.whereNotIn
Static
whereStatic
whereStatic
whereThe static version of the whereNotNull method.
BuildsQuery.prototype.whereNotNull
Static
whereThe static version of the whereNull method.
BuildsQuery.prototype.whereNull
Static
withThe static version of the with method.
BuildsQuery.prototype.with
Static
withoutThe static version of the with method.
BuildsQuery.prototype.without
Generated using TypeDoc
The attributes that should be cast.