---
title: "Notifications — Messages for Laravel | Roundly"
description: "Opt in to bridge every new message to Laravel notifications for the thread’s other participants — your class, your channels."
url: https://roundly-consulting.com/open-source/docs/messages-for-laravel/notifications
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Messages for Laravel](https://roundly-consulting.com/open-source/docs/messages-for-laravel.md)

# Notifications

Opt in to bridge new messages to Laravel notifications. When enabled, every sent message notifies the thread’s other notifiable participants — the sender is never notified, and participants without Laravel’s Notifiable trait are skipped:

```bash
MESSAGES_NOTIFICATIONS=true
```

```php
// config/messages.php
'notifications' => [
    'enabled' => env('MESSAGES_NOTIFICATIONS', false),
    'notification' => RoundlyConsulting\Messages\Notifications\NewMessageNotification::class,
    'channels' => ['database'],   // mail is never forced
],
```

## The default notification

RoundlyConsulting\\Messages\\Notifications\\NewMessageNotification is queued (ShouldQueue), delivers via notifications.channels, and implements toArray() with:

- message\_id and thread\_id,
- preview — the message’s truncated, type-aware preview,
- sender\_id and sender\_type — the sender’s class basename (User), resolved through the morph map and never its class name; null for a system message.

The same array is the database and the broadcast payload. It implements no toMail(), so mail needs your own class.

## Customising

To customise channels and content, publish an editable copy of the default and point the config at it — the copy lives in your app namespace and starts out behaving exactly like the package’s notification:

```bash
php artisan vendor:publish --tag="messages-notifications"
# → app/Notifications/Messages/NewMessageNotification.php (App\Notifications\Messages)
```

```php
// config/messages.php
'notifications' => [
    'notification' => App\Notifications\Messages\NewMessageNotification::class,
],
```

A copy published by 1.1.x or earlier still puts the sender’s morph type in sender\_type — the full class name (App\\Models\\User) on an app without a morph map. Re-publish it with --force, which overwrites your edits, or copy the sender\_type code over from the package’s notification.

Or point notifications.notification at a class of your own — it is constructed with the sent Message, so extending the default works too:

```php
use RoundlyConsulting\Messages\Notifications\NewMessageNotification;

class ChatMessageReceived extends NewMessageNotification
{
    // $this->message is the sent Message — override via() or toArray(), or add toMail()
}

// config/messages.php
'notification' => App\Notifications\ChatMessageReceived::class,
```

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/messages-for-laravel.md)
