Skip to Content

Last Updated: 3/13/2026


Data Models

LinkAce is built on Laravel and uses Eloquent ORM for database interactions. This document describes the core data models and their relationships.

The Link model represents a bookmarked URL with metadata.

Location: app/Models/Link.php

Properties

PropertyTypeDescription
idintPrimary key
user_idintForeign key to User
urlstringThe bookmarked URL
titlestringLink title
descriptionstring|nullOptional description
iconstring|nullIcon identifier
visibilityintVisibility level (1=public, 2=internal, 3=private)
statusintLink status (1=OK, 2=moved, 3=broken)
check_disabledbooleanWhether automatic link checking is disabled
last_checked_atdatetimeLast time the link was checked
thumbnailstring|nullThumbnail image URL
created_atdatetimeCreation timestamp
updated_atdatetimeLast update timestamp
deleted_atdatetime|nullSoft delete timestamp

Status Constants

const STATUS_OK = 1; // Link is working const STATUS_MOVED = 2; // Link has moved (redirect) const STATUS_BROKEN = 3; // Link is broken (404, etc.)

Display Constants

const DISPLAY_CARDS = 1; // Card view const DISPLAY_LIST_SIMPLE = 2; // Simple list view const DISPLAY_LIST_DETAILED = 3; // Detailed list view

Relationships

  • user() - BelongsTo User (with soft deletes)
  • lists() - BelongsToMany LinkList (through link_lists pivot table)
  • tags() - BelongsToMany Tag (through link_tags pivot table)
  • notes() - HasMany Note
  • audits() - MorphMany (audit trail)

Key Methods

getFormattedDescriptionAttribute(): string

Returns the description formatted as Markdown (if enabled in user settings) or as plain HTML-escaped text.

shortUrl(): string

Returns the URL with https:// removed. Other protocols (magnet://, ftp://, etc.) are preserved.

shortTitle(int $maxLength = 50): string

Returns a truncated version of the title.

domainOfURL(): string

Extracts and returns the domain name from the URL.

getIcon(string $additionalClasses = ''): string

Returns the HTML for the link’s icon, with status-based overrides (warning for moved links, danger for broken links).

addedAt(): string

Returns a formatted timestamp with relative time display.

initiateInternetArchiveBackup(): void

Dispatches a job to save the link to the Wayback Machine if Internet Archive backups are enabled.

searchDuplicateUrls(): Collection

Searches for other links with similar URLs (ignoring scheme, query parameters, and fragments).

Scopes

  • byUser(int $user_id = null) - Filter links by user
  • privateOnly() - Only private links
  • internalOnly() - Only internal links
  • publicOnly() - Only public links

Traits Used

  • AuditableTrait - Tracks changes
  • HasFactory - Factory support for testing
  • ProvidesTaxonomyOutput - Taxonomy helpers
  • ScopesForUser - User-scoped queries
  • ScopesVisibility - Visibility-based queries
  • SoftDeletes - Soft delete support

The LinkList model represents a collection of links.

Location: app/Models/LinkList.php

Properties

PropertyTypeDescription
idintPrimary key
user_idintForeign key to User
namestringList name
descriptionstring|nullOptional description
visibilityintVisibility level
created_atdatetimeCreation timestamp
updated_atdatetimeLast update timestamp
deleted_atdatetime|nullSoft delete timestamp

Relationships

  • user() - BelongsTo User
  • links() - BelongsToMany Link (through link_lists pivot table)

Tag Model

The Tag model represents a tag that can be applied to links.

Location: app/Models/Tag.php

Properties

PropertyTypeDescription
idintPrimary key
user_idintForeign key to User
namestringTag name
visibilityintVisibility level
created_atdatetimeCreation timestamp
updated_atdatetimeLast update timestamp
deleted_atdatetime|nullSoft delete timestamp

Relationships

  • user() - BelongsTo User
  • links() - BelongsToMany Link (through link_tags pivot table)

Note Model

The Note model represents a note attached to a link.

Location: app/Models/Note.php

Properties

PropertyTypeDescription
idintPrimary key
user_idintForeign key to User
link_idintForeign key to Link
notetextNote content
created_atdatetimeCreation timestamp
updated_atdatetimeLast update timestamp
deleted_atdatetime|nullSoft delete timestamp

Relationships

  • user() - BelongsTo User
  • link() - BelongsTo Link

User Model

The User model represents a LinkAce user account.

Location: app/Models/User.php

Properties

PropertyTypeDescription
idintPrimary key
namestringUser’s display name
emailstringEmail address (unique)
email_verified_atdatetime|nullEmail verification timestamp
passwordstringHashed password
remember_tokenstring|nullRemember me token
oauth_providerstring|nullOAuth provider name (if using SSO)
oauth_idstring|nullOAuth provider user ID
created_atdatetimeCreation timestamp
updated_atdatetimeLast update timestamp
deleted_atdatetime|nullSoft delete timestamp

Relationships

  • links() - HasMany Link
  • lists() - HasMany LinkList
  • tags() - HasMany Tag
  • notes() - HasMany Note
  • settings() - HasMany (user settings)
  • roles() - BelongsToMany Role (Spatie permissions)
  • permissions() - BelongsToMany Permission (Spatie permissions)

UserInvitation Model

The UserInvitation model represents pending user invitations.

Location: app/Models/UserInvitation.php

Properties

PropertyTypeDescription
idintPrimary key
invited_byintForeign key to User who sent invitation
emailstringInvited email address
tokenstringInvitation token
expires_atdatetimeExpiration timestamp
accepted_atdatetime|nullAcceptance timestamp
created_atdatetimeCreation timestamp
updated_atdatetimeLast update timestamp

Database Schema

Pivot Tables

Links the many-to-many relationship between Links and Lists.

ColumnType
link_idint
list_idint

Links the many-to-many relationship between Links and Tags.

ColumnType
link_idint
tag_idint

Audit Tables

LinkAce uses the owen-it/laravel-auditing package to track changes to models.

audits

Stores audit trail for model changes.

ColumnTypeDescription
idintPrimary key
user_typestringAuditable user type
user_idintUser who made the change
eventstringEvent type (created, updated, deleted)
auditable_typestringModel type
auditable_idintModel ID
old_valuesjsonPrevious values
new_valuesjsonNew values
urlstringRequest URL
ip_addressstringUser IP
user_agentstringUser agent
tagsstringOptional tags
created_atdatetimeAudit timestamp

Activity Log

LinkAce uses spatie/laravel-activitylog for activity tracking.

activity_log

Stores general activity logs.

ColumnTypeDescription
idintPrimary key
log_namestringLog category
descriptiontextActivity description
subject_typestringSubject model type
subject_idintSubject model ID
causer_typestringCauser model type
causer_idintCauser model ID
propertiesjsonAdditional properties
created_atdatetimeActivity timestamp

Visibility Levels

All main models (Link, LinkList, Tag) support three visibility levels:

LevelValueDescription
Public1Visible to everyone
Internal2Visible to authenticated users
Private3Visible only to owner

These are defined in app/Enums/ModelAttribute.php:

const VISIBILITY_PUBLIC = 1; const VISIBILITY_INTERNAL = 2; const VISIBILITY_PRIVATE = 3;