Home API Tools Posts Hire Me About
Sign In Create Account
Laravel

Laravel Notifications: Multi-Channel Alerts

January 16, 2026 1 min read 13 views

Multi-channel notifications:

Create Notification

php artisan make:notification OrderShipped

Notification Class

class OrderShipped extends Notification
{
    public function via($notifiable)
    {
        return ['mail', 'database'];
    }

    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->line('Your order has shipped!')
            ->action('View Order', url('/orders/'.$this->order->id));
    }

    public function toArray($notifiable)
    {
        return ['order_id' => $this->order->id];
    }
}

Send Notification

$user->notify(new OrderShipped($order));
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!