class OrderShipped extends Notification {
public function via(User $notifiable): array {
return ['mail', 'database', 'slack'];
}
public function toMail(User $notifiable): MailMessage {
return (new MailMessage)
->subject('Order Shipped')
->line('Your order has been shipped.');
}
public function toDatabase(User $notifiable): array {
return ['order_id' => $this->order->id, 'status' => 'shipped'];
}
}
$user->notify(new OrderShipped($order));
Notification::send($users, new OrderShipped($order));Каналы: mail, database, broadcast, Slack, SMS (Vonage), push и custom.