Optional$optionsOptional$primaryOptional$trxLoad relationships onto the instance
Load aggregates
Load count
Load relationships onto the instance, but only if they are not already preloaded
Alias for "load"
Static$adapterAdapter to work as a bridge between query builder and the model
Static$columnsA map of defined columns
Static$computedA map of computed properties
Static$hooksReference to hooks
Static$keysA copy of internal keys mapping. One should be able to resolve between all key versions
Static$relationsA map of defined relationships
Static ReadonlybootedWhether or not model has been booted. After this model configurations are ignored
Static ReadonlyconnectionStaticnamingNaming strategy to use
StaticprimaryThe primary key for finding unique referencing to a model
StaticselfSelf assign the primary instead of relying on the database to return it back
Static ReadonlytableStatictransactionReturns transaction client from the model. It is same as calling "db.transaction"
Consume the adapter result and hydrate the model
OptionalsideloadAttributes: ModelObjectGives an option to the end user to define constraints for update, insert and delete queries. Since the query builder for these queries aren't exposed to the end user, this method opens up the API to build custom queries.
OptionaldefaultValue: anyRead/write realtionships. Following methods are intentionally loosely typed, so that one can bypass the public facing API and type checking for advanced use cases
Read/write attributes. Following methods are intentionally loosely typed, so that one can bypass the public facing API and type checking for advanced use cases
Optionaloptions: ModelAdapterOptionsPerform delete by issuing a delete request on the adapter
Same as [[BaseModel.delete]] without invoking hooks
Enable force update even when no attributes are dirty
OptionalallowExtraProperties: booleanOptionalfields: OptionalallowExtraProperties: booleanReload/Refresh the model instance
Returns related model for a given relationship
Actions to perform on the instance
Perform save on the model without invoking hooks.
Serialize model to a plain object
OptionalcherryPick: CherryPickSerialize attributes to a plain object
Optionalfields: CherryPickFieldsOptionalraw: booleanSerialize computed properties to a plain object
Optionalfields: CherryPickFieldsSerialize relationships to key-value pair of model instances and their serializeAs keys
Serialize relationships to key-value pair of plain nested objects
OptionalcherryPick: { [relation: string]: CherryPick }Optionalraw: booleanSerialize everything
Converts model to an object. It just returns the properties of the model, along with preloaded relationships
Static$addManaging columns
Static$addManaging computed columns
Static$addManaging relationships
Static$createStatic$createStatic$defineDefine a static property on the model using the inherit or define strategy.
Inherit strategy will clone the property from the parent model and will set it on the current model
Static$getStatic$getStatic$getGet relationship declaration
Static$hasStatic$hasStatic$hasFind if a relationship exists
StaticafterStaticallStaticbeforeStaticbootBoot model
StaticcreateStaticcreateStaticcreateStaticcreateStaticfetchFind rows or create many when missing. One db call is invoked for each create
StaticfetchFind rows or create in-memory instances of the missing one's.
StaticfindStaticfindStaticfindStaticfindStaticfindStaticfindStaticfirstStaticfirstStaticfirstStaticfirstReturns the first row or create a new instance of model without persisting it
StaticqueryStatictruncateTruncate model table
Optionalcascade: booleanStaticupdateStaticupdateUpdate existing rows or create new one's.
StaticuseDefine an adapter to use for interacting with the database
Columns is a property to get type information for model attributes. This must be declared by the end user