Skip to content

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.

FolderNamespaceModelsWhat it coversPage
app/Models/*.phpApp\Models34Users, workspaces and membership, roles and permissions, invitations, enterprise SSO, external users, branding, mail settings, modules, announcements, device tokensCore models
app/Models/EmailControl/App\Models\EmailControl3Per-role and per-user email notification switchesCore models
app/Models/Project/App\Models\Project1ProjectUserNotificationBadges (the rest of the old Projects module is gone)Core models
app/Models/DAM/App\Models\DAM47Assets, versions, folders, Collages, tags, custom fields, portals, share links, portal users, notifications, asset ordering, DAM subscriptionsDAM models
app/Models/LM/App\Models\LM74Lead Management: dealers and dealerships, RSM assignment, leads, lead products, tasks, notes, emails, forms, guest tracking, product catalogue, Mautic / SharpSpring / Twilio / Numverify / SMTP / IMAP settingsLM 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 termModelTable
AssetDAM\DigitalAssetsdigital_assets
FolderDAM\DigitalAssetsCategorydigital_assets_categories
CollageDAM\DamCollectiondam_collections
PortalDAM\DamInstancedam_instances
Share linkDAM\ShareAssetsCategoryshare_assets_category
Portal userDAM\DealerUsersdealer_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, so DigitalAssets maps to digital_assets and DamInstancesUsers to dam_instances_users.
  • 39 models set $table explicitly, 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 use DigitalAssets*.
  • No model sets $connection; everything uses the default database connection.
  • Two class names exist twice: DealerUserInvitations (in DAM and LM, same table) and ZipCode (LM\ZipCode model and the App\ZipCode\ZipCode service).

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:

ModelIndex (table name)shouldBeSearchable()Eager loads for re-index (makeAllSearchableUsing)
DigitalAssetsdigital_assetsnot archived, not deleted, not final-deleted, has a folderinstancePermissions, workspace, all_tags, user, externalUser, assetsCustomFields.customField, damCollectionAssets
DigitalAssetsCategorydigital_assets_categoriesnot trashed, not final-deletedinstancePermissions
DamCollectiondam_collectionsnot overriddeninstancePermissions, workspace
DigitalAssetsTagdigital_assets_tagshas a tag name and its asset is live and in a folderdigitalAsset

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_id column (52 $fillable lists include it), and controllers add where('workspace_id', ...) themselves.
  • Admin API routes carry url_workspace_id, which is the workspace url_slug. The checkUserWithWS middleware (VerifyUserWithWorkSpace) looks up the workspace by slug and rejects the request with code 420 unless the user has a row in workspace_users. It also runs the enterprise SSO re-check (SsoEntryCheck).
  • Portal API routes (dam-api guard) go through DAMAPIMiddleware. It resolves the portal from instance_id, the X-Instance-Id header or the user's own instance_id, checks DamInstancesUsers (unless the user is a backend user), and merges dam_instance_id and dam_workspace_id into the request.
  • Portal visibility of folders, assets and Collages is stored per portal in the polymorphic dam_instance_permissions table (DamInstancePermission, morph name permissionable).
  • Workspaces can be nested: workspaces.parent_id points at a parent workspace, and User::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() and limited_tags() join tags on assets_version_id, while all_tags() joins on digital_assets_id.
  • DamCollectionAssets::assets() is declared as hasMany(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.