Object Contract Hierarchy
Core uses a three-tier contract hierarchy to define how objects are displayed and managed:ObjectContract
The base contract for all displayable objects in the UI. Provides fundamental display methods that UI components likeObjectColumn, ObjectDetailedLink, and ObjectCard depend on.
Responsibilities:
- Display properties (title, subtitle, icon, avatar)
- Navigation URLs (internal routes or external links)
- Visual styling (badge icons, colors, tooltips)
- Object references (related entities)
ResourceObjectContract
For external integration models that sync data from external systems (e.g. Fortnox invoices, Shopify orders). Additional capabilities:- ETL operations with
fillTransformedData() - Raw JSON storage from external APIs
- Batch import tracking with timestamps
- Source data change detection with
latestSourceUpdatedAt()
HasResourceObject trait. Stores raw data in a data JSON column. URLs typically point to the external system. No activity logging.
DomainObjectContract
For core business entities that users work with directly (e.g. User, Order, Customer). Additional capabilities:- Global search integration via Laravel Scout
- Activity logging with custom formatting
- Collection management (
getDomainObjectCollectionUrl()) - Search priority and authorization
HasDomainObject trait. Most models in your application should implement this contract.
Use
ResourceObjectContract only for data synced from external systems. All first-party entities should be DomainObjectContract.The Domain Object Contract
ImplementDomainObjectContract and use the HasDomainObject trait:
app/Models/Company.php
Permissions
Every domain object requires two permissions inapp/Enums/Permission.php:
Next Steps
Object Schema
Define typed properties and drive tables, forms, and UI from a single schema.
Object Capabilities
Enable search, activity logging, and other platform capabilities.
Actions
Create reusable, authorized operations for your domain objects.
Pages
Wire domain objects to Inertia pages using CoreShowPage and CoreIndexPage.