Notification::route()
Send notifications to recipients who aren't users — email addresses, phone numbers, or Slack channels — without a Notifiable model.
Overview
Notification::route() creates an anonymous notifiable, letting you send notifications to arbitrary addresses without needing a User model or any model at all. Perfect for sending alerts to external contacts, admin emails, or webhook URLs.
Usage
use Illuminate\Support\Facades\Notification;
use App\Notifications\ServerDownNotification;
Notification::route('mail', '[email protected]')
->route('slack', '#alerts')
->notify(new ServerDownNotification($server));
You can chain multiple channels:
Notification::route('mail', [
'[email protected]' => 'CTO',
'[email protected]' => 'VP Engineering',
])
->route('vonage', '15551234567')
->notify(new CriticalAlertNotification($message));
Real-World Examples
Contact form submission — notify the business without a User model:
class ContactFormController
{
public function __invoke(ContactFormRequest $request): RedirectResponse
{
Notification::route('mail', config('mail.contact_address'))
->notify(new ContactFormSubmitted(
name: $request->validated('name'),
email: $request->validated('email'),
message: $request->validated('message'),
));
return back()->with('success', 'Message sent!');
}
}
Alerting an external monitoring channel:
// In a scheduled health check
Notification::route('slack', config('services.slack.ops_webhook'))
->notify(new DiskSpaceLow($percentage));
When to Use
- Contact forms, feedback forms, or support requests
- System alerts to external email addresses or Slack channels
- Invitations to people who don't have accounts yet
- Any notification where the recipient isn't a model in your database