📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Laravel Framework Notifications

Notifications

5 min read
Send multi-channel notifications via mail, database, Slack, or SMS using Laravel Notifications.

Notifications

php artisan make:notification OrderShipped

class OrderShipped extends Notification implements ShouldQueue {
    public function via(object $notifiable): array {
        return ["mail", "database"];  // channels
    }

    public function toMail(object $notifiable): MailMessage {
        return (new MailMessage)
            ->subject("Your order has shipped!")
            ->line("Order #" . $this->order->id . " is on its way.")
            ->action("Track Order", url("/orders/" . $this->order->id))
            ->line("Thank you!");
    }

    public function toArray(object $notifiable): array {
        return ["order_id" => $this->order->id, "status" => "shipped"];
    }
}

// Send
$user->notify(new OrderShipped($order));
Notification::send(User::all(), new NewFeature());
Sign in to track your progress.