Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/0m1n3m/contacts-db/llms.txt

Use this file to discover all available pages before exploring further.

Contacts DB includes a built-in notification system that keeps team members informed about activity on the tasks they care about. Whenever something relevant happens — a task is assigned to you, someone mentions you in a comment, a file is uploaded, or a deadline is approaching — a notification is created in the database and surfaced via the bell icon in the navigation bar. Clicking the icon opens a dropdown showing your three most recent notifications, with a link to the full notification list at /notifications.

Notification types

The NotificationService defines five distinct notification types. Each is triggered by a specific action and carries a structured title and message.
TypeTriggerTitle formatMessage format
assignmentA user is assigned to a task"{actor} assigned you a task""Task: {title}"
mentionA user is @mentioned in a comment"{actor} mentioned you"Excerpt of the comment text
uploadA file is uploaded to a task the user is on"{actor} uploaded a file""File: {filename}"
status_changeA task’s status changes for users assigned to it"{actor} changed task status""{title}: {old} → {new}"
task_due_soonAutomated: a task is due within N days"Task due soon""{title} is due in {N} days"
The task_due_soon type has no human actor — its triggered_by field is null because it is fired by the NotifyTasksDueingSoon console command rather than a user action.

Notification data model

Each notification row in the notifications table captures the full context needed to render the alert and link the user to the relevant resource.
ColumnTypeDescription
idbigintAuto-incrementing primary key
user_idbigint FKThe recipient of the notification
typestringOne of: assignment, mention, upload, status_change, task_due_soon
titlestringShort headline shown in the notification
messagetext (nullable)Supporting detail — task name, comment excerpt, filename, etc.
action_urlstring (nullable)URL the user is taken to when they interact with the notification
action_labelstringLabel for the call-to-action button, e.g. "View Task" or "View Attachments"
notifiable_typestringFully-qualified class name of the related model, e.g. App\Models\Task
notifiable_idbigintPrimary key of the related model instance
triggered_bybigint FK (nullable)The user who caused the notification; null for automated types
read_attimestamp (nullable)Set when the notification is read; null means unread
created_at / updated_attimestampsStandard Laravel timestamps
The table has a composite index on (user_id, read_at) for fast unread-count queries, and a polymorphic index on (notifiable_type, notifiable_id) for lookups by related entity.

Reading notifications

Bell icon & unread count

The navbar bell badge displays the number of unread notifications. The count is fetched by polling GET /notifications/unread-count, which returns a JSON object:
{ "count": 5 }

Recent notifications dropdown

Clicking the bell loads the three most recent notifications via GET /api/notifications/recent. The response is a JSON array of notification objects (see the example payload below).

Routes reference

ActionMethodRoute
View all notifications (paginated)GET/notifications
Get unread countGET/notifications/unread-count
Get recent notifications (dropdown)GET/api/notifications/recent
Mark one notification as readPOST/notifications/{id}/read
Mark all as read (full page)POST/notifications/mark-all-read
Mark all as read (AJAX, no redirect)POST/notifications/mark-all-read-ajax
Delete a notificationDELETE/notifications/{id}
All routes require an authenticated, verified session. A user can only mark or delete their own notifications — the controller enforces ownership and returns 403 if $notification->user_id !== auth()->id().

Example notification payload

The GET /api/notifications/recent endpoint returns an array of objects shaped like this:
{
  "id": 42,
  "type": "assignment",
  "title": "Alice assigned you a task",
  "message": "Task: Redesign login page",
  "action_url": "/tasks/15",
  "is_read": false,
  "created_at": "2026-07-20T10:30:00Z"
}
A false value for is_read means the notification has not been read yet. Once the user interacts with the notification the field becomes true and the badge count decrements accordingly.

Due soon reminders

The task_due_soon notification type is generated automatically by the NotifyTasksDueingSoon Artisan console command. This command queries tasks whose due date falls within the next 7 days (hardcoded), have a status other than done, and have not already received a due-soon reminder. It creates a notification for every user assigned to the task and for the task’s creator, ensuring the right people are always alerted.
Schedule the command in your routes/console.php or app/Console/Kernel.php to run daily so users receive timely reminders without manual intervention:
Schedule::command('tasks:notify-due-soon')->dailyAt('08:00');
On production servers, make sure the Laravel task scheduler itself is registered in your system cron:
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Build docs developers (and LLMs) love