Skip to content

DAM Models ​

Overview ​

The 47 Eloquent models in app/Models/DAM/ (namespace App\Models\DAM). They cover the asset library, portals, sharing, notifications, the asset ordering cart and DAM subscriptions. Everything on this page is read from the model files at commit f517b6b. Where a model has no $fillable, the column list comes from database/migrations (including database/migrations/update).

Product terms used in the UI map to these models:

UI termModelTable
AssetDigitalAssetsdigital_assets
Asset versionAssetsVersionassets_versions
FolderDigitalAssetsCategorydigital_assets_categories
CollageDamCollection, pivot DamCollectionAssetsdam_collections, dam_collection_assets
TagDigitalAssetsTagdigital_assets_tags
Custom field and its value on an assetCustomField, AssetsCustomFieldcustom_fields, assets_custom_fields
PortalDamInstancedam_instances
Portal visibility of a folder, asset or CollageDamInstancePermission (polymorphic)dam_instance_permissions
Portal tiles and bannersDamTile, InstanceBannerdam_tiles, instance_banners
Portal user (logs in with the dam-api guard)DealerUsersdealer_users
Share linkShareAssetsCategoryshare_assets_category
External app (API key, external-api guard)DamExternalAppdam_external_apps

Notes that apply across the folder:

  • DamInstancePermission is a polymorphic table. permissionable_type stores the full class name (for example App\Models\DAM\DigitalAssetsCategory); there is no morph map. DigitalAssets, DigitalAssetsCategory and DamCollection expose it as instancePermissions() (morphMany).
  • Four models use Laravel Scout with the Typesense collection schemas defined in config/scout.php: DigitalAssets, DigitalAssetsCategory, DamCollection, DigitalAssetsTag. None override searchableAs(), so the index name is the table name plus the optional SCOUT_PREFIX. shouldBeSearchable() keeps archived, deleted and uncategorised assets out of the index (DigitalAssets), drops trashed folders (DigitalAssetsCategory), and drops tags whose asset is archived, deleted or uncategorised (DigitalAssetsTag).
  • DealerUserInvitations exists in both App\Models\DAM and App\Models\LM with the same default table dealer_user_invitations.
  • Addon points at table add_ons; no migration for that table exists in the snapshot.

See also: Models overview, LM models, Core models.

Inventory ​

ModelTableTraitsRelations
Addonadd_onsHasFactory0
AssetsCustomFieldassets_custom_fields-2
AssetsVersionassets_versions-2
CouponscouponsHasFactory0
CustomFieldcustom_fieldsSoftDeletes1
DAMUserAddressdam_user_addressesHasFactory0
DamAcldam_acl-0
DamAssetOrderSettingdam_asset_order_settings-0
DamAssetProductdam_asset_products-1
DamAssetProductCartdam_asset_product_carts-3
DamAssetProductOrderdam_asset_product_orders-4
DamAssetProductOrderItemdam_asset_product_order_items-3
DamAssetProductOrderShippingdam_asset_product_order_shippings-0
DamAssetWatermarkSettingdam_asset_watermark_settings-0
DamAssetsConvertdam_assets_convertsHasFactory, SoftDeletes2
DamCollectiondam_collectionsSoftDeletes, Searchable3
DamCollectionAssetsdam_collection_assets-1
DamExternalAppdam_external_appsHasApiTokens0
DamGroupdam_groupsHasFactory2
DamGroupUserdam_group_usersHasFactory0
DamInquirydam_inquiryHasFactory1
DamInstancedam_instancesSoftDeletes2
DamInstancePermissiondam_instance_permissions-2
DamInstancesUsersdam_instances_usersSoftDeletes1
DamNotificationdam_notificationsHasFactory0
DamNotificationGroupdam_notification_groupsHasFactory1
DamSearchHistorydam_search_histories-0
DamSystemNotificationsdam_system_notificationsHasFactory0
DamTiledam_tiles-2
DamUserNotificationsdam_user_notificationsHasFactory1
DealerUserInvitationsdealer_user_invitations-1
DealerUsersdealer_usersHasApiTokens, Notifiable, SoftDeletes3
DealerUsersActivitydealer_users_activities-0
DigitalAssetsdigital_assetsSearchable14
DigitalAssetsCategorydigital_assets_categoriesSoftDeletes, Searchable7
DigitalAssetsDownloaddigital_assets_downloads-0
DigitalAssetsTagdigital_assets_tagsSearchable1
ImportDataimport_dataHasFactory0
InstanceBannerinstance_bannersSoftDeletes1
ShareAssetsCategoryshare_assets_categorySoftDeletes0
SubscriptionAddonsubscription_addonsHasFactory0
SubscriptionUserActivitysubscription_user_activities-1
SubscriptionUserAddonsubscription_user_addonsHasFactory, SoftDeletes1
SubscriptionUserssubscription_usersHasFactory4
SubscriptionssubscriptionsHasFactory1
TransactionActivitytransaction_activitiesHasFactory0
WorkspaceRestructureDataworkspace_restructure_data-0

Models ​

Addon ​

app/Models/DAM/Addon.php · table add_ons · traits HasFactory

Fillable: price, tokens, is_active, created_at, updated_at

AssetsCustomField ​

app/Models/DAM/AssetsCustomField.php · table assets_custom_fields

Fillable: workspace_id, asset_id, custom_field_id, value, status

RelationTypeRelatedKeysConstraints
customField()belongsToCustomField--
asset()belongsToDigitalAssets--

AssetsVersion ​

app/Models/DAM/AssetsVersion.php · table assets_versions (default)

Fillable: id, asset_id, version, workspace_id, user_id, file_name, display_file_name, file_type, file_size, height, width, terms_of_use, description, auto_tag, type, category_id, is_categorized, file_meta_data, checksum_value, thumbnail_file, compress_file, video_preview, is_public, is_embed_code, embed_key, embed_code_date, visible_in_trashed, is_archive, is_deleted, final_deleted, is_recent, is_editorial_use, file_preview_id, file_preview_status, created_at, updated_at

Casts: width → integer, height → integer

Appends: preview_image, embed_code

RelationTypeRelatedKeysConstraints
user()belongsToUseruser_id, id->select('id', 'name', 'email', 'profile_image')
workspace()belongsToWorkspaceworkspace_id, id-

Scopes: downloadAssetQry, excludeAdmin, customWhere, assetSizeQry

Accessors: getDisplayFileAttribute, getPreviewImageAttribute, getThumbnailFileAttribute, getVideoPreviewAttribute, getCompressFileAttribute, getEmbedCodeAttribute, getCollectionAttribute

Other methods: generateEmbedUrl(), enableEmbedCode()

Model events (booted): saving throws InvalidArgumentException('Invalid asset file name.') when a changed file_name is not a plain file name (UploadedObjectUrl::isPlainFileName(): 1-255 characters, no /, \, .. or control characters), so a stored name cannot escape the <slug>/digital_assets/ S3 prefix.

Coupons ​

app/Models/DAM/Coupons.php · table coupons (default) · traits HasFactory

Mass assignment: no $fillable or $guarded, so Laravel default $guarded = ['*'] applies.

Columns (from migrations): id, name, code, type, value, plans, expiration_date, total_redeemed, is_active, created_at, updated_at

CustomField ​

app/Models/DAM/CustomField.php · table custom_fields · traits SoftDeletes

Fillable: workspace_id, field_type, field_label, field_value, field_settings, placeholder_text, admin_only, status

Casts: field_value → CustomFieldOptions::class, field_settings → FlexibleJson::class

RelationTypeRelatedKeysConstraints
assetsCustomFields()hasManyAssetsCustomFieldcustom_field_id-

DAMUserAddress ​

app/Models/DAM/DAMUserAddress.php · table dam_user_addresses · traits HasFactory

Fillable: id, workspace_id, user_id, user_name, user_email, user_phone, address1, address2, city, state, county, zip_code, company_name, created_at, updated_at

DamAcl ​

app/Models/DAM/DamAcl.php · table dam_acl

Fillable: id, workspace_id, user_id, name, position, is_active

Hidden: deleted_at

DamAssetOrderSetting ​

app/Models/DAM/DamAssetOrderSetting.php · table dam_asset_order_settings (default)

Mass assignment: no $fillable or $guarded, so Laravel default $guarded = ['*'] applies.

Columns (from migrations): id, workspace_id, user_id, admin_id, is_sku_automatic, workspace_abbreviation, product_number, is_prefix, is_suffix, is_required, is_order_automatic, order_number, created_at, updated_at

DamAssetProduct ​

app/Models/DAM/DamAssetProduct.php · table dam_asset_products (default)

Mass assignment: no $fillable or $guarded, so Laravel default $guarded = ['*'] applies.

Columns (from migrations): id, workspace_id, asset_id, user_id, sku, unit, pricing_option, options, is_product, is_customize, created_at, updated_at, sku_number

RelationTypeRelatedKeysConstraints
asset()belongsToDigitalAssetsasset_id, id-

DamAssetProductCart ​

app/Models/DAM/DamAssetProductCart.php · table dam_asset_product_carts (default)

Mass assignment: no $fillable or $guarded, so Laravel default $guarded = ['*'] applies.

Columns (from migrations): id, workspace_id, user_id, asset_id, asset_version_id, asset_product_id, display_file_name, file_name, file_type, qty, unit, base_price, created_at, updated_at, selected_option, total_amount, base_qty

Appends: original_file_name

RelationTypeRelatedKeysConstraints
asset()belongsToDigitalAssetsasset_id, id-
product()belongsToDamAssetProductasset_product_id, id-
workspace()belongsToWorkspaceworkspace_id, id-

Scopes: assetUserPermission

Accessors: getFileNameAttribute, getOriginalFileNameAttribute

DamAssetProductOrder ​

app/Models/DAM/DamAssetProductOrder.php · table dam_asset_product_orders (default)

Fillable: is_dismiss

Appends: status_id, status_color, status_background_color, mobile_status_color, mobile_status_background_color

Dates: invoice_date

RelationTypeRelatedKeysConstraints
order_item()hasManyDamAssetProductOrderItemorder_id, id-
shpping_info()belongsToDamAssetProductOrderShippingid, order_id-
user()belongsToDealerUsersuser_id, id->select('id', 'name', 'email', 'profile_image')
workspace()belongsToWorkspaceworkspace_id, id-

Accessors: getStatusAttribute, getStatusIdAttribute, getStatusColorAttribute, getStatusBackgroundColorAttribute, getMobileStatusColorAttribute, getMobileStatusBackgroundColorAttribute

DamAssetProductOrderItem ​

app/Models/DAM/DamAssetProductOrderItem.php · table dam_asset_product_order_items (default)

Mass assignment: no $fillable or $guarded, so Laravel default $guarded = ['*'] applies.

Columns (from migrations): id, workspace_id, user_id, asset_id, asset_version_id, order_id, display_file_name, file_name, file_type, qty, unit, base_price, created_at, updated_at, total_amount, base_qty

RelationTypeRelatedKeysConstraints
workspace()belongsToWorkspaceworkspace_id, id-
asset()belongsToDigitalAssetsasset_id, id-
assetProduct()belongsToDigitalAssetsasset_id, id->select('id', 'is_public', 'is_archive', 'is_deleted')

Accessors: getFileNameAttribute

DamAssetProductOrderShipping ​

app/Models/DAM/DamAssetProductOrderShipping.php · table dam_asset_product_order_shippings (default)

Fillable: id, workspace_id, user_id, order_id, shipping_company_name, shipping_user_name, shipping_user_email, shipping_user_phone, address1, address2, city, state, country, zip_code

DamAssetWatermarkSetting ​

app/Models/DAM/DamAssetWatermarkSetting.php · table dam_asset_watermark_settings (default)

Mass assignment: no $fillable or $guarded, so Laravel default $guarded = ['*'] applies.

Columns (from migrations): id, workspace_id, type, text, font_size, font_color, image, image_name, opacity, position, orientation, created_at, updated_at, is_check, image_type, image_size

DamAssetsConvert ​

app/Models/DAM/DamAssetsConvert.php · table dam_assets_converts (default) · traits HasFactory, SoftDeletes

Fillable: id, workspace_id, user_id, asset_id, version_id, file_name, asset_type, convert_type, status, is_backend_user, email_send, is_active, created_at, updated_at

RelationTypeRelatedKeysConstraints
workspace()belongsToWorkspaceworkspace_id, id-
version()belongsToAssetsVersionversion_id, id-

DamCollection ​

app/Models/DAM/DamCollection.php · table dam_collections (default) · traits SoftDeletes, Searchable

Fillable: id, workspace_id, instance_id, user_id, name, description, is_backend_user, permission_type, permission, group_id, modified_at, visibility

Hidden: deleted_at, visibility, instancePermissions

Appends: assets_count, assets_id, preview_image, preview_images, instance_visibility

RelationTypeRelatedKeysConstraints
workspace()belongsToWorkspaceworkspace_id, id-
assets()hasManyDamCollectionAssetscollection_id-
instancePermissions()morphManyDamInstancePermissionpermissionable-

Scopes: instanceVisible, userPermission

Accessors: getAssetsCountAttribute, getPreviewImageAttribute, getPreviewImagesAttribute, getAssetsIdAttribute, getUserAttribute, getInstanceVisibilityAttribute

Scout / Typesense: indexed through toSearchableArray(); collection schema in config/scout.php has fields id, workspace_id, collection_name, search_name, description, preview_images, instance_visibility, assets_count, created_by, created_at, modified_at, assets_id.

Other methods: getInstancePreviewImages()

DamCollectionAssets ​

app/Models/DAM/DamCollectionAssets.php · table dam_collection_assets (default)

Fillable: collection_id, asset_id

RelationTypeRelatedKeysConstraints
assets()hasManyDigitalAssetsid, asset_id-

DamExternalApp ​

app/Models/DAM/DamExternalApp.php · table dam_external_apps (default) · extends Authenticatable · traits HasApiTokens

Fillable: id, workspace_id, name, url, key, secrete, is_active

DamGroup ​

app/Models/DAM/DamGroup.php · table dam_groups (default) · traits HasFactory

Fillable: id, instance_id, workspace_id, group_icon, group_name

Appends: display_group_icon

RelationTypeRelatedKeysConstraints
users()belongsToManyDealerUsersdam_group_users, group_id, user_id->select('dealer_users.id', 'dealer_users.name', 'dealer_users.email', 'dealer_users.profile_image') ...
workspaces()hasOneWorkspaceid, workspace_id->select('id', 'id as workspace_unique_id', 'url_slug as workspace_id', 'name as workspace_name')

Accessors: getdisplaygroupiconAttribute

Other methods: GroupUserSync()

DamGroupUser ​

app/Models/DAM/DamGroupUser.php · table dam_group_users (default) · traits HasFactory

Mass assignment: no $fillable or $guarded, so Laravel default $guarded = ['*'] applies.

Columns (from migrations): id, workspace_id, group_id, user_id, created_at, updated_at

DamInquiry ​

app/Models/DAM/DamInquiry.php · table dam_inquiry · traits HasFactory

Fillable: id, subscription_id, stripe_customer_id, stripe_payment_id, stripe_subscription_id, coupon_id, name, email, company_name, phone, price, discount, pay_amount, payment_type, payment_status, payment_status_alias, is_active

RelationTypeRelatedKeysConstraints
subscription()belongsToSubscriptionssubscription_id, id-

DamInstance ​

app/Models/DAM/DamInstance.php · table dam_instances (default) · traits SoftDeletes

Fillable: id, workspace_id, brand_name, description, logo, favicon, url, cname, is_domain, is_pointed, is_slider, is_active, is_public_portal, total_storage_in_gb, used_storage_in_gb, settings, storage_mail_status

Casts: is_domain → integer

Hidden: deleted_at, created_at, updated_at, storage_mail_status

RelationTypeRelatedKeysConstraints
workspace()belongsToWorkspaceworkspace_id-
permissions()hasManyDamInstancePermissiondam_instance_id-

Accessors: getLoginUrlAttribute, getLogoAttribute, getFaviconAttribute, getSettingsAttribute, getStorageMailStatusAttribute

login_url is a signed PortalLoginTicket for this portal (12 hours): for an Admin User a ticket for that user, for a backend DealerUsers a ticket for its backend_login_user_id, otherwise null. Previously it was md5(user id). Constant PUBLIC_PORTAL_EMAIL names the anonymous account of a public portal.

Other methods: checkUser(), damStorageLimitCheck(), workspaceSeatCounts(), checkFeatureRestriction(), checkMailBranding(), formatSubscriptionStorage()

DamInstancePermission ​

app/Models/DAM/DamInstancePermission.php · table dam_instance_permissions (default)

Fillable: dam_instance_id, workspace_id, permissionable_id, permissionable_type, visibility

RelationTypeRelatedKeysConstraints
permissionable()morphTo(polymorphic)--
instance()belongsToDamInstancedam_instance_id-

Other methods: bulkUpsertVisibility()

DamInstancesUsers ​

app/Models/DAM/DamInstancesUsers.php · table dam_instances_users (default) · traits SoftDeletes

Fillable: id, instance_id, user_id, instance_status

Hidden: created_at, updated_at, deleted_at

RelationTypeRelatedKeysConstraints
instance()belongsToDamInstanceinstance_id-

DamNotification ​

app/Models/DAM/DamNotification.php · table dam_notifications (default) · traits HasFactory

Fillable: id, workspace_id, notification_name, notification_text, notification_slug, notification_group_id, is_email, is_system, is_organization, is_user, user_recipient, admin_recipient, created_at, updated_at

Other methods: sendEmailNotification()

DamNotificationGroup ​

app/Models/DAM/DamNotificationGroup.php · table dam_notification_groups (default) · traits HasFactory

Fillable: id, group_name, slug, created_at, updated_at

RelationTypeRelatedKeysConstraints
notification()hasManyDamNotificationnotification_group_id, id-

DamSearchHistory ​

app/Models/DAM/DamSearchHistory.php · table dam_search_histories (default)

Fillable: id, workspace_id, user_id, terms, search_text, user_type, search_by, location, ip_address

Accessors: getUserAttribute

DamSystemNotifications ​

app/Models/DAM/DamSystemNotifications.php · table dam_system_notifications (default) · traits HasFactory

Fillable: id, user_id, workspace_id, sender_user_id, instance_id, notification_text, notification_url, read_at, created_at, updated_at

DamTile ​

app/Models/DAM/DamTile.php · table dam_tiles (default)

Fillable: id, workspace_id, instance_id, user_id, title, url, image, image_name, position, is_active, description

Casts: is_active → integer

Hidden: created_at, updated_at

RelationTypeRelatedKeysConstraints
workspace()belongsToWorkspaceworkspace_id, id-
instance()belongsToDamInstanceinstance_id, id-

Accessors: getImageAttribute

DamUserNotifications ​

app/Models/DAM/DamUserNotifications.php · table dam_user_notifications (default) · traits HasFactory

Fillable: id, user_id, workspace_id, notification_id, is_email, is_system, created_at, updated_at

RelationTypeRelatedKeysConstraints
user()belongsToUseruser_id, id-

DealerUserInvitations ​

app/Models/DAM/DealerUserInvitations.php · table dealer_user_invitations (default)

Fillable: user_id, instance_id, token

RelationTypeRelatedKeysConstraints
user()belongsToDealerUsersuser_id-

DealerUsers ​

app/Models/DAM/DealerUsers.php · table dealer_users (default) · extends Authenticatable · traits HasApiTokens, Notifiable, SoftDeletes

Fillable: id, dealer_id, instance_id, user_id, name, email, phone, profile_image, is_active, backend_login_user_id, is_backend_user, password, is_revoked, last_login

Hidden: password, deleted_at

Appends: display_thumb_profile_image

RelationTypeRelatedKeysConstraints
dealer()belongsToDealerdealer_id-
instance()belongsToDamInstanceinstance_id-
damInstancesUsers()hasManyThroughDamInstanceDamInstancesUsers::class, user_id, id-

Accessors: getDisplayThumbProfileImageAttribute, getProfileImageAttribute

Other methods: shortName(), isPublicPortalAccount() (email equals DamInstance::PUBLIC_PORTAL_EMAIL; that account's password and profile cannot be changed from the portal)

DealerUsersActivity ​

app/Models/DAM/DealerUsersActivity.php · table dealer_users_activities (default)

Fillable: id, workspace_id, user_id, log_details, activity_url

DigitalAssets ​

app/Models/DAM/DigitalAssets.php · table digital_assets (default) · traits Searchable

Fillable: id, assets_version_id, version, workspace_id, user_id, file_name, display_file_name, file_type, file_size, height, width, terms_of_use, description, auto_tag, type, category_id, share_id, file_meta_data, thumbnail_file, compress_file, video_preview, acl_permission, is_public, visible_in_trashed, folder_permission, collection_permission, is_archive, archive_by, is_deleted, final_deleted, is_recent, is_editorial_use, file_preview_id, file_preview_status, modified_at, created_at, updated_at, watermark_file, watermark_original_file, visibility, is_external_upload

Casts: width → integer, height → integer

Hidden: visibility, instancePermissions

Appends: preview_image, collection, instance_visibility

RelationTypeRelatedKeysConstraints
damCollectionAssets()hasManyDamCollectionAssetsasset_id, id-
category()belongsToDigitalAssetsCategorycategory_id, id->select('id', 'folder_name', 'parent_id')
user()belongsToUseruser_id, id->select('id', 'name', 'email', 'profile_image')
archiveUser()belongsToUserarchive_by, id->select('id', 'name', 'email', 'profile_image')
externalUser()belongsToExternalUseruser_id, id->select('id', 'name', 'email')
tags()hasManyDigitalAssetsTagassets_version_id, assets_version_id-
limited_tags()hasManyDigitalAssetsTagassets_version_id, assets_version_id->where('vision_type', 'labels')->whereNotNull('tag_name')
all_tags()hasManyDigitalAssetsTagdigital_assets_id, id->where('vision_type', 'labels')->whereNotNull('tag_name')
workspace()belongsToWorkspaceworkspace_id, id-
versions()hasManyAssetsVersionasset_id->where('is_deleted', 0)
acl()hasManyDamAclworkspace_id, workspace_id->where('is_active', 1)
assetsCustomFields()hasManyAssetsCustomFieldasset_id-
assetProduct()belongsToDamAssetProductid, asset_id-
instancePermissions()morphManyDamInstancePermissionpermissionable-

Scopes: assetsByType, downloadAssetQry, collectionNameQry, excludeAdmin, customWhere, assetSizeQry, assetUserPermission, orderByMaxTag, instanceVisible

Accessors: getModifiedAtAttribute, getFileMetaDataAttribute, getDisplayFileAttribute, getPreviewImageAttribute, getEmailPreviewImageAttribute, getThumbnailFileAttribute, getVideoPreviewAttribute, getCompressFileAttribute, getCollectionAttribute, getShareIdAttribute, getAclPermissionAttribute, getWatermarkFileAttribute, getWatermarkOriginalFileAttribute, getInstanceVisibilityAttribute

Scout / Typesense: indexed through toSearchableArray(); collection schema in config/scout.php has fields id, workspace_id, instances_id, display_file_name, description, search_name, file_type, type, thumbnail_file, compress_file, video_preview, display_file, file_size, height, width, orientation, instance_visibility, is_external_upload, category_id, is_collection, collection_ids, created_by, created_by_id, created_at, modified_at, tags, custom_fields, custom_field_values, portal_custom_fields, portal_custom_field_values, breadcrumb. The indexed display_file (S3 key <url_slug>/digital_assets/<file_name>) is set only for file types gif, pdf, doc, docx, ppt, pptx, xlsx, xls, dotx, odt, ott, txt, svg and md (1ad517ad).

Other methods: getCachedInstanceId(), loadCategoryCache(), getTagsMapForAssets(), searchableCustomFieldValue(), getCustomFieldsMapForAssets(), getAssetsSearchCustomFields(), getAssetsCustomFields(), getAssetsCustomFieldsDealer(), getThumbnailSize(), getCompressSize(), normalizeImageColorToSrgb(), resizeAndEncodeWebp(), getTrendingOrRecentData(), getShareLinkData(), subCategoryIds(), getRequestedAssetsFilesSize(), subCategoryAssets(), addCategoryAssetsInZip(), generateFileFromVideo(), convertFile(), generateWatermarkFile(), filterMaxTagCount(), assetBreadcrumb()

Model events (booted): saving rejects a changed file_name that is not a plain file name, same rule as AssetsVersion. Conversion helpers now accept only a plain extension for the stored type and convert_type and shell-quote every argument, because both end up in a shell command.

DigitalAssetsCategory ​

app/Models/DAM/DigitalAssetsCategory.php · table digital_assets_categories (default) · traits SoftDeletes, Searchable

Fillable: workspace_id, user_id, parent_id, folder_name, description, category_path, integration_type, visible_in_trashed, permission_type, permission, group_id, final_deleted, created_at, updated_at, modified_at, visibility

Hidden: deleted_at, final_deleted, visible_in_trashed, visibility, instancePermissions

Appends: instance_visibility

RelationTypeRelatedKeysConstraints
subcategory()hasManyDigitalAssetsCategoryparent_id, id->with('subcategory')
parent()belongsToDigitalAssetsCategoryparent_id->with('parent')
signleparent()belongsToDigitalAssetsCategoryparent_id->with('parent')
children()hasManyDigitalAssetsCategoryparent_id-
subCategories()hasManyDigitalAssetsCategoryparent_id, id-
assets()hasManyDigitalAssetscategory_id, id-
instancePermissions()morphManyDamInstancePermissionpermissionable-

Scopes: instanceVisible, userPermission

Accessors: getInstanceVisibilityAttribute

Scout / Typesense: indexed through toSearchableArray(); collection schema in config/scout.php has fields id, workspace_id, instances_id, parent_id, folder_name, search_name, description, breadcrumb, instance_visibility, created_at, modified_at.

Other methods: getCachedInstanceId(), getCategoryBreadcrumb(), addCategoryShareAssetsCount(), addCategoryAssetsInCount()

DigitalAssetsDownload ​

app/Models/DAM/DigitalAssetsDownload.php · table digital_assets_downloads (default)

Fillable: id, workspace_id, user_id, digital_assets_id, assets_version_id, share_id, collection_id, is_backend_download, download_by, asset_from, type, location, ip_address, zip_file_name

Accessors: getUserAttribute

DigitalAssetsTag ​

app/Models/DAM/DigitalAssetsTag.php · table digital_assets_tags (default) · traits Searchable

Fillable: workspace_id, user_id, digital_assets_id, tag_name, assets_version_id, search_tag_name

Hidden: created_at, updated_at

RelationTypeRelatedKeysConstraints
digitalAsset()belongsToDigitalAssetsdigital_assets_id-

Scopes: assetUserPermission

Scout / Typesense: indexed through toSearchableArray(); collection schema in config/scout.php has fields id, workspace_id, instances_id, tag_name, search_name, created_at.

Other methods: getCachedInstanceId()

ImportData ​

app/Models/DAM/ImportData.php · table import_data (default) · traits HasFactory

Fillable: id, workspace_id, user_id, sheet_name, category_name, category_id, sub_category_name, sub_category_id, asset_id, asset_name, asset_url, description, bf_attachment_id, bf_Asset_id, asset_tags, custom_fields, is_added_to_platform, note, migration_status, migration_result, attempts

Casts: migration_result → array

InstanceBanner ​

app/Models/DAM/InstanceBanner.php · table instance_banners (default) · traits SoftDeletes

Fillable: instance_id, title, position, image, image_name, url, description, is_active

Casts: is_active → integer

Hidden: deleted_at, created_at, updated_at

RelationTypeRelatedKeysConstraints
instance()belongsToDamInstanceinstance_id-

Accessors: getImageAttribute

ShareAssetsCategory ​

app/Models/DAM/ShareAssetsCategory.php · table share_assets_category · traits SoftDeletes

Fillable: id, workspace_id, instance_id, assets_id, category_id, collection_id, title, description, password, expiration, expires_at, expires_timezone, hide_download, share_origin, generated_source, generated_by, total_visited, is_active, created_at, updated_at

Hidden: password

Appends: front_url, password_required, share_url, user, is_expired

Casts: expires_at => datetime (stored in config('app.timezone'), serialised as UTC ISO)

Scopes: collectionNameQry, notExpired (expires_at after now(), or expires_at null and expiration null or TIMESTAMP(expiration, '23:59:59') after now()), expired (expires_at at or before now(), or expires_at null and TIMESTAMP(expiration, '23:59:59') at or before now()). The date-only branch was added so queries match is_expired. Both qualify the columns with the model table, so they work on joined queries.

Accessors: getShareUrlAttribute, getFrontUrlAttribute, getPasswordRequiredAttribute, getUserAttribute, getIsExpiredAttribute (true when resolvedExpiresAt() is at or before now())

Other methods: resolvedExpiresAt() returns expires_at, or for a row with only expiration the end of that date in the app time zone; static expiresAtFor(?string $date, string $timezone) returns the end of $date in $timezone converted to the app time zone, or null for an empty date; static expiryColumns(?string $date, string $timezone) returns ['expiration' => $date, 'expires_at' => expiresAtFor(...), 'expires_timezone' => $timezone], all null when there is no date (used by create and update). See Sharing: expiry.

Added in PR #453: isOpenFor($accessToken, $checkPassword = true) is true when the share is active, not expired and, if it has a password, $accessToken equals it (hash_equals); containsCategory($categoryId) is true when the folder is one of the share's folders or inside one (walks parent_id within the share's workspace); static idsBelongToWorkspace(array $assetIds, array $categoryIds, int $workspaceId) is true when every id is a positive integer naming an asset or folder of that workspace (uses whereIntegerInRaw so large shares stay under MySQL's placeholder limit). Share creation uses it to refuse foreign ids with 422 Some of the selected assets or folders are not available in this workspace.

SubscriptionAddon ​

app/Models/DAM/SubscriptionAddon.php · table subscription_addons · $timestamps = true · traits HasFactory

Fillable: name, slug, stripe_reference_id, group_name, billing_cycle, price, tokens, is_active, created_at, updated_at

Other methods: createAddonPlan()

SubscriptionUserActivity ​

app/Models/DAM/SubscriptionUserActivity.php · table subscription_user_activities (default)

Fillable: id, workspace_id, user_id, log_details, activity_performed_by, created_at, updated_at

RelationTypeRelatedKeysConstraints
users()belongsToUseruser_id, id->select('id', 'name', 'email', 'phone', 'default_workspace')

SubscriptionUserAddon ​

app/Models/DAM/SubscriptionUserAddon.php · table subscription_user_addons · traits HasFactory, SoftDeletes

Fillable: subscription_addon_id , subscription_user_id, is_deleted, created_at, updated_at, deleted_at

RelationTypeRelatedKeysConstraints
subscription_addon()belongsToSubscriptionAddonsubscription_addon_id, id-

SubscriptionUsers ​

app/Models/DAM/SubscriptionUsers.php · table subscription_users (default) · traits HasFactory

Fillable: id, user_id, workspace_id, stripe_customer_id, stripe_payment_id, stripe_subscription_id, subscription_id, features, coupon_id, payment_status, payment_status_alias, billing_cycle, price, discount, pay_amount, payment_type, is_active, is_existing_user, start_date, cancel_reason, cancel_comment, status, next_billing_date, next_subscription_id, dashboard_walkthrough, is_backoffice_user, payment_link, payment_pause, created_at, updated_at, trial_days, trial_end_date, is_trial_account, trial_expire, is_suspended, openai_image_count, email_send_number, email_flag

Dates: created_at

RelationTypeRelatedKeysConstraints
users()belongsToUseruser_id, id->select('id', 'name', 'email', 'phone', 'default_workspace', 'timezone', 'last_name')
subscription()belongsToSubscriptionssubscription_id-
inquiry()belongsToDamInquirystripe_customer_id, stripe_customer_id-
totalStorage()hasManyAssetsVersionworkspace_id, workspace_id->where("final_deleted", 0)

Scopes: listedActive

Accessors: getFeaturesAttribute

Other methods: getPaymentStatus()

Subscriptions ​

app/Models/DAM/Subscriptions.php · table subscriptions (default) · traits HasFactory

Fillable: name, slug, stripe_reference_id, group_name, type, billing_cycle, price, features, is_active, created_at, updated_at

RelationTypeRelatedKeysConstraints
subscriptionUsers()hasManySubscriptionUserssubscription_id, id-

Accessors: getFeaturesAttribute

Mutators: setFeaturesAttribute

Other methods: createStripePlan()

TransactionActivity ​

app/Models/DAM/TransactionActivity.php · table transaction_activities (default) · traits HasFactory

Fillable: id, transaction_number, workspace_id, instance_id, asset_id, version_id, collection_id, category_id, share_id, user_id, event, sub_event, environment, system_data, city, state, country_code, ipv4, postal, country_name

Static methods: recordAgentEvent(Request $request, int $workspaceId, string $event, string $subEvent, array $ids = []) (since 8d907a3). Writes one row with environment = 'agent', user_id from the token, system_data {"client": "<marker>"}, ipv4 and transaction_number = highest + 1; no geo columns. environment values are admin, dealer, external, anonymous and agent. See Agent (MCP) requests in analytics.

WorkspaceRestructureData ​

app/Models/DAM/WorkspaceRestructureData.php · table workspace_restructure_data

Fillable: workspace_id, sheet_name, batch_id, asset_id, current_folder_id, target_folder_id, current_asset_name, new_asset_name, status, is_folder_changed, is_name_changed, note, processed_at

Casts: batch_id → integer, asset_id → integer, current_folder_id → integer, target_folder_id → integer, is_folder_changed → boolean, is_name_changed → boolean, processed_at → datetime