إشعارات متعددة القنوات:
إنشاء إشعار
php artisan make:notification OrderShippedفئة الإشعار
class OrderShipped extends Notification
{
public function via($notifiable)
{
return ['mail', 'database'];
}
public function toMail($notifiable)
{
return (new MailMessage)
->line('تم شحن طلبك!')
->action('عرض الطلب', url('/orders/'.$this->order->id));
}
public function toArray($notifiable)
{
return ['order_id' => $this->order->id];
}
}إرسال الإشعار
$user->notify(new OrderShipped($order));