Skip to main content

Extending Core Models

You can extend core models by creating your own classes to add custom behavior and relationships.

Model Classes

It is recommended to extend the existing model classes in Unleash Commerce rather than creating entirely new models. This allows you to inherit all the built-in functionality while adding your own customizations. Create your own model that extends a core model:

Registering Custom Models

Register your custom model using the ModelManifest in a service provider:

Adding a custom factory

If you want your extended model to use a custom Laravel factory, define the factory class and override newFactory() on the model. Example model:
Example factory:

Available Models to Extend

Refer to the Models Reference for a complete list of available models you can extend.