Skip to main content

What are notifications?

Notifications are short, informational messages sent to users when something happens in your application—an invoice is paid, a password is reset, a deployment completes. Unlike mailables, a single notification class can deliver its message across multiple channels. The same InvoicePaid notification can send an email and save a database record simultaneously.

Generating notifications

Create a notification with Artisan:
This generates app/Notifications/InvoicePaid.php.

Sending notifications

Via the notifiable trait

The App\Models\User model includes the Notifiable trait by default, which exposes a notify method:
You can add Notifiable to any model, not just User.

Via the Notification facade

Send to multiple users at once using the Notification facade:

Specifying delivery channels

Every notification class has a via method that returns which channels to use:
Built-in channels: You can also route to a specific channel based on user preferences:

Mail notifications

Define a toMail method on the notification to format the email:

Markdown mail notifications

Generate a notification with a Markdown template for full HTML control:
Use markdown instead of chaining MailMessage methods:

Database notifications

Store notifications in a database table and display them in your UI.

Setup

Create the notifications table:
Add database to the via method, then define a toDatabase (or toArray) method returning an array of data:

Reading notifications

Access a user’s notifications through the notifications relationship:
Mark notifications as read:

Queueing notifications

Notifications that call external services should be queued. Add ShouldQueue and Queueable:
Now $user->notify(new InvoicePaid($invoice)) queues the notification automatically.

Delaying delivery

Delay different channels by different amounts:

On-demand notifications

Send a notification to a recipient who isn’t stored in your database:

Slack notifications

Define a toSlack method after connecting a Slack app to your workspace:

A complete example

1

Generate the notification

2

Write the notification class

3

Send the notification

4

Display in-app notifications

Testing notifications

Use Notification::fake() to assert notifications are sent without actually delivering them:

Mail

Learn how to build rich HTML email templates with mailable classes and Markdown components.
Last modified on April 19, 2026