interface Channel

Contract for delivering notifications over a specific transport (database, mail, SMS, etc).

Implementations should:

  • Accept a notifiable entity and a notification instance.
  • Consume the payload produced by the corresponding toX() method (e.g., toDatabase(), toMail()).
  • Perform the side-effecting delivery and throw on failure (so callers can log/retry).

Methods

void
send(object $notifiable, Notification $notification, mixed $payload)

Deliver the notification for this channel.

static string
name()

The short channel name used in via(): e.g. 'database', 'mail', 'sms'.

Details

at line 33
void send(object $notifiable, Notification $notification, mixed $payload)

Deliver the notification for this channel.

Implementations SHOULD be idempotent when possible, or document non-idempotent behavior. If delivery fails, throw an exception to allow the caller (or a queue worker) to handle retries.

Parameters

object $notifiable

The user/entity receiving the notification.

Notification $notification

The notification instance.

mixed $payload

Usually the result of toX() (array/DTO)

Return Value

void

at line 40
static string name()

The short channel name used in via(): e.g. 'database', 'mail', 'sms'.

Return Value

string

The name of the channel.