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.
Link Model
The Link model represents a bookmarked URL with metadata.
Location: app/Models/Link.php
Properties
| Property | Type | Description |
|---|---|---|
id | int | Primary key |
user_id | int | Foreign key to User |
url | string | The bookmarked URL |
title | string | Link title |
description | string|null | Optional description |
icon | string|null | Icon identifier |
visibility | int | Visibility level (1=public, 2=internal, 3=private) |
status | int | Link status (1=OK, 2=moved, 3=broken) |
check_disabled | boolean | Whether automatic link checking is disabled |
last_checked_at | datetime | Last time the link was checked |
thumbnail | string|null | Thumbnail image URL |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last update timestamp |
deleted_at | datetime|null | Soft 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 viewRelationships
user()- BelongsTo User (with soft deletes)lists()- BelongsToMany LinkList (throughlink_listspivot table)tags()- BelongsToMany Tag (throughlink_tagspivot table)notes()- HasMany Noteaudits()- 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 userprivateOnly()- Only private linksinternalOnly()- Only internal linkspublicOnly()- Only public links
Traits Used
AuditableTrait- Tracks changesHasFactory- Factory support for testingProvidesTaxonomyOutput- Taxonomy helpersScopesForUser- User-scoped queriesScopesVisibility- Visibility-based queriesSoftDeletes- Soft delete support
LinkList Model
The LinkList model represents a collection of links.
Location: app/Models/LinkList.php
Properties
| Property | Type | Description |
|---|---|---|
id | int | Primary key |
user_id | int | Foreign key to User |
name | string | List name |
description | string|null | Optional description |
visibility | int | Visibility level |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last update timestamp |
deleted_at | datetime|null | Soft delete timestamp |
Relationships
user()- BelongsTo Userlinks()- BelongsToMany Link (throughlink_listspivot table)
Tag Model
The Tag model represents a tag that can be applied to links.
Location: app/Models/Tag.php
Properties
| Property | Type | Description |
|---|---|---|
id | int | Primary key |
user_id | int | Foreign key to User |
name | string | Tag name |
visibility | int | Visibility level |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last update timestamp |
deleted_at | datetime|null | Soft delete timestamp |
Relationships
user()- BelongsTo Userlinks()- BelongsToMany Link (throughlink_tagspivot table)
Note Model
The Note model represents a note attached to a link.
Location: app/Models/Note.php
Properties
| Property | Type | Description |
|---|---|---|
id | int | Primary key |
user_id | int | Foreign key to User |
link_id | int | Foreign key to Link |
note | text | Note content |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last update timestamp |
deleted_at | datetime|null | Soft delete timestamp |
Relationships
user()- BelongsTo Userlink()- BelongsTo Link
User Model
The User model represents a LinkAce user account.
Location: app/Models/User.php
Properties
| Property | Type | Description |
|---|---|---|
id | int | Primary key |
name | string | User’s display name |
email | string | Email address (unique) |
email_verified_at | datetime|null | Email verification timestamp |
password | string | Hashed password |
remember_token | string|null | Remember me token |
oauth_provider | string|null | OAuth provider name (if using SSO) |
oauth_id | string|null | OAuth provider user ID |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last update timestamp |
deleted_at | datetime|null | Soft delete timestamp |
Relationships
links()- HasMany Linklists()- HasMany LinkListtags()- HasMany Tagnotes()- HasMany Notesettings()- 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
| Property | Type | Description |
|---|---|---|
id | int | Primary key |
invited_by | int | Foreign key to User who sent invitation |
email | string | Invited email address |
token | string | Invitation token |
expires_at | datetime | Expiration timestamp |
accepted_at | datetime|null | Acceptance timestamp |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last update timestamp |
Database Schema
Pivot Tables
link_lists
Links the many-to-many relationship between Links and Lists.
| Column | Type |
|---|---|
link_id | int |
list_id | int |
link_tags
Links the many-to-many relationship between Links and Tags.
| Column | Type |
|---|---|
link_id | int |
tag_id | int |
Audit Tables
LinkAce uses the owen-it/laravel-auditing package to track changes to models.
audits
Stores audit trail for model changes.
| Column | Type | Description |
|---|---|---|
id | int | Primary key |
user_type | string | Auditable user type |
user_id | int | User who made the change |
event | string | Event type (created, updated, deleted) |
auditable_type | string | Model type |
auditable_id | int | Model ID |
old_values | json | Previous values |
new_values | json | New values |
url | string | Request URL |
ip_address | string | User IP |
user_agent | string | User agent |
tags | string | Optional tags |
created_at | datetime | Audit timestamp |
Activity Log
LinkAce uses spatie/laravel-activitylog for activity tracking.
activity_log
Stores general activity logs.
| Column | Type | Description |
|---|---|---|
id | int | Primary key |
log_name | string | Log category |
description | text | Activity description |
subject_type | string | Subject model type |
subject_id | int | Subject model ID |
causer_type | string | Causer model type |
causer_id | int | Causer model ID |
properties | json | Additional properties |
created_at | datetime | Activity timestamp |
Visibility Levels
All main models (Link, LinkList, Tag) support three visibility levels:
| Level | Value | Description |
|---|---|---|
| Public | 1 | Visible to everyone |
| Internal | 2 | Visible to authenticated users |
| Private | 3 | Visible only to owner |
These are defined in app/Enums/ModelAttribute.php:
const VISIBILITY_PUBLIC = 1;
const VISIBILITY_INTERNAL = 2;
const VISIBILITY_PRIVATE = 3;