master

laravel/framework

Last updated at: 29/12/2023 09:23

NotificationFailed.php

TLDR

This file defines the NotificationFailed class, which represents an event that occurs when a notification fails to be sent.

Classes

NotificationFailed

The NotificationFailed class represents an event that occurs when a notification fails to be sent. It includes properties for the notifiable entity who received the notification, the notification instance, the channel name, and the data needed to process this failure. The class also includes a constructor method that allows you to initialize the class properties.

<?php

namespace Illuminate\Notifications\Events;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;

class NotificationFailed
{
    use Queueable, SerializesModels;

    /**
     * The notifiable entity who received the notification.
     *
     * @var mixed
     */
    public $notifiable;

    /**
     * The notification instance.
     *
     * @var \Illuminate\Notifications\Notification
     */
    public $notification;

    /**
     * The channel name.
     *
     * @var string
     */
    public $channel;

    /**
     * The data needed to process this failure.
     *
     * @var array
     */
    public $data = [];

    /**
     * Create a new event instance.
     *
     * @param  mixed  $notifiable
     * @param  \Illuminate\Notifications\Notification  $notification
     * @param  string  $channel
     * @param  array  $data
     * @return void
     */
    public function __construct($notifiable, $notification, $channel, $data = [])
    {
        $this->data = $data;
        $this->channel = $channel;
        $this->notifiable = $notifiable;
        $this->notification = $notification;
    }
}