Appearance
Models ​
Overview ​
The Backend-API (Laravel 11) has 158 Eloquent models under app/Models. This section documents every one of them, read from source at commit f517b6b (origin/development, 29 Oct 2026). For each model you get the table, traits, mass-assignment fields, casts, hidden and appended attributes, relationships, scopes, accessors, mutators and model events.
| Folder | Namespace | Models | What it covers | Page |
|---|---|---|---|---|
app/Models/*.php | App\Models | 34 | Users, workspaces and membership, roles and permissions, invitations, enterprise SSO, external users, branding, mail settings, modules, announcements, device tokens | Core models |
app/Models/EmailControl/ | App\Models\EmailControl | 3 | Per-role and per-user email notification switches | Core models |
app/Models/Project/ | App\Models\Project | 1 | ProjectUserNotificationBadges (the rest of the old Projects module is gone) | Core models |
app/Models/DAM/ | App\Models\DAM | 47 | Assets, versions, folders, Collages, tags, custom fields, portals, share links, portal users, notifications, asset ordering, DAM subscriptions | DAM models |
app/Models/LM/ | App\Models\LM | 74 | Lead Management: dealers and dealerships, RSM assignment, leads, lead products, tasks, notes, emails, forms, guest tracking, product catalogue, Mautic / SharpSpring / Twilio / Numverify / SMTP / IMAP settings | LM models |
app/WorkSpaceActivity, app/ProjectActivity, app/PushNotification, app/ZipCode and app/WebAuthn look like model folders but hold service classes behind facades. They are listed at the end of Core models.
What "LM" means ​
LM is the Lead Management module. Workspaces turn modules on through ModuleWorkspace: module id 1 is Projects, 2 is DAM and 3 is Lead Management (FeedbackController labels them, Web/Subscription/UserController maps 3 to lm_module). LM models are about dealers, dealerships and leads, not about the DAM. The DAM folder has its own DealerUsers model, which is the portal user account (auth provider for the dam-api guard), and an LM\Dealer link through DealerUsers::dealer().
Naming conventions ​
The API names are older than the UI names. Use this map when reading code:
| UI term | Model | Table |
|---|---|---|
| Asset | DAM\DigitalAssets | digital_assets |
| Folder | DAM\DigitalAssetsCategory | digital_assets_categories |
| Collage | DAM\DamCollection | dam_collections |
| Portal | DAM\DamInstance | dam_instances |
| Share link | DAM\ShareAssetsCategory | share_assets_category |
| Portal user | DAM\DealerUsers | dealer_users |
- Class names are not consistent in number: some are plural (
DigitalAssets,Subscriptions,DealerUsers,Modules), most are singular. One class is lowercase (feedback). Default table names follow Laravel's snake-case plural of the class name, soDigitalAssetsmaps todigital_assetsandDamInstancesUserstodam_instances_users. - 39 models set
$tableexplicitly, usually because the table is singular (dam_acl,dam_inquiry,share_assets_category,lead_status,twilio,numverify,role_user). - DAM-specific models are mostly prefixed
Dam(DamInstance,DamTile,DamCollection); the oldest asset tables useDigitalAssets*. - No model sets
$connection; everything uses the default database connection. - Two class names exist twice:
DealerUserInvitations(inDAMandLM, same table) andZipCode(LM\ZipCodemodel and theApp\ZipCode\ZipCodeservice).
Mass assignment ​
Only 75 models declare $fillable. 18 set $guarded = [] (17 in LM plus feedback). The remaining 65 declare neither, so Laravel's default $guarded = ['*'] applies and create() / fill() do nothing for them; code writes those rows by setting properties and calling save(), or with the query builder. Nothing in app/ calls Model::unguard(). For those models the pages list the columns from database/migrations instead.
Soft deletes ​
14 models use SoftDeletes: User, ExternalUser, DAM\CustomField, DAM\DamAssetsConvert, DAM\DamCollection, DAM\DamInstance, DAM\DamInstancesUsers, DAM\DealerUsers, DAM\DigitalAssetsCategory, DAM\InstanceBanner, DAM\ShareAssetsCategory, DAM\SubscriptionUserAddon, LM\Dealership, LM\Product.
DigitalAssets itself does not use SoftDeletes. Asset trash and archive state are plain columns (is_deleted, final_deleted, visible_in_trashed, is_archive), and folders carry visible_in_trashed and final_deleted on top of deleted_at.
Search (Scout and Typesense) ​
Four DAM models use Laravel\Scout\Searchable. Their Typesense collection schemas live in config/scout.php under typesense.model-settings:
| Model | Index (table name) | shouldBeSearchable() | Eager loads for re-index (makeAllSearchableUsing) |
|---|---|---|---|
DigitalAssets | digital_assets | not archived, not deleted, not final-deleted, has a folder | instancePermissions, workspace, all_tags, user, externalUser, assetsCustomFields.customField, damCollectionAssets |
DigitalAssetsCategory | digital_assets_categories | not trashed, not final-deleted | instancePermissions |
DamCollection | dam_collections | not overridden | instancePermissions, workspace |
DigitalAssetsTag | digital_assets_tags | has a tag name and its asset is live and in a folder | digitalAsset |
None override searchableAs(), so the index name is the table name with the optional SCOUT_PREFIX. Every schema has workspace_id. The asset, folder and tag schemas also have instances_id, and the asset, folder and Collage schemas have instance_visibility (int64[]), so search queries can filter by workspace and by portal.
Multi-tenancy by workspace ​
There is no global scope or tenant trait. No model calls addGlobalScope. Workspace isolation is explicit:
- Almost every business table has a
workspace_idcolumn (52$fillablelists include it), and controllers addwhere('workspace_id', ...)themselves. - Admin API routes carry
url_workspace_id, which is the workspaceurl_slug. ThecheckUserWithWSmiddleware (VerifyUserWithWorkSpace) looks up the workspace by slug and rejects the request with code420unless the user has a row inworkspace_users. It also runs the enterprise SSO re-check (SsoEntryCheck). - Portal API routes (
dam-apiguard) go throughDAMAPIMiddleware. It resolves the portal frominstance_id, theX-Instance-Idheader or the user's owninstance_id, checksDamInstancesUsers(unless the user is a backend user), and mergesdam_instance_idanddam_workspace_idinto the request. - Portal visibility of folders, assets and Collages is stored per portal in the polymorphic
dam_instance_permissionstable (DamInstancePermission, morph namepermissionable). - Workspaces can be nested:
workspaces.parent_idpoints at a parent workspace, andUser::workspaces()returns only top-level ones (whereNull('parent_id')).
Core DAM relationships ​
The diagram shows the relations defined on the models (method names on the edges). Dotted lines are plain foreign-key columns with no relation method.
Entity names map to classes: DIGITAL_ASSETS is DigitalAssets (asset), DIGITAL_ASSETS_CATEGORY is DigitalAssetsCategory (folder), DAM_COLLECTION is DamCollection (Collage), DAM_INSTANCE is DamInstance (portal), SHARE_ASSETS_CATEGORY is ShareAssetsCategory (share link), DEALER_USERS is DealerUsers (portal user).
Two details the diagram hides:
DigitalAssets::tags()andlimited_tags()join tags onassets_version_id, whileall_tags()joins ondigital_assets_id.DamCollectionAssets::assets()is declared ashasMany(DigitalAssets, 'id', 'asset_id'), so from the pivot side an item returns a collection of assets, not a single asset.
Pages ​
- Core models:
User,Workspace, SSO, roles, invitations, EmailControl, and non-Eloquent service classes. - DAM models: every model in
app/Models/DAM. - LM models: every model in
app/Models/LM.