---
title: "Notification routing — Contacts for Laravel | Roundly"
description: "Opt a model into routing mail, Vonage and Twilio notifications to its primary email and phone with RoutesNotificationsViaContacts."
url: https://roundly-consulting.com/open-source/docs/contacts-for-laravel/notifications
language: en
---

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

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

# Notification routing

Opt in by adding RoutesNotificationsViaContacts alongside HasContacts. It resolves Laravel notification destinations from the owner’s primary contacts:

```php
use Illuminate\Notifications\Notifiable;
use RoundlyConsulting\Contacts\Concerns\HasContacts;
use RoundlyConsulting\Contacts\Concerns\RoutesNotificationsViaContacts;

class User extends Model
{
    use HasContacts;
    use Notifiable;
    use RoutesNotificationsViaContacts;
}
```

```php
$user->addEmail('jane@example.com', primary: true);
$user->addPhone('+421 900 000 000', primary: true);

$user->routeNotificationForMail();     // 'jane@example.com'
$user->routeNotificationForVonage();   // '+421900000000'
$user->routeNotificationForTwilio();   // '+421900000000'

$user->notify(new OrderShipped($order));   // your own notification class
```

- routeNotificationForMail() — the primary email.
- routeNotificationForVonage() and routeNotificationForTwilio() — the primary phone.
- Each returns null when there is no primary of that kind, so Laravel simply skips that channel.

## Precedence

The trait is intentionally separate from HasContacts and is not applied automatically, because host models often already use Notifiable. When you do add it, these routeNotificationFor\*() methods take precedence over Notifiable’s attribute-based routing for the mail, Vonage and Twilio channels.

## 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/contacts-for-laravel.md)
