abdallahmohammed/alsaad-notification-channel

Alsaad2 通知通道,适用于 Laravel。

v1.0.0 2020-05-12 10:07 UTC

This package is auto-updated.

Last update: 2024-09-12 19:40:05 UTC


README

在 Laravel 中使用 Alsaad 发送 SMS 通知。在您可以通过 Alsaad 发送通知之前,需要安装 abdallahmohammed/alsaad-notification-channel Composer 包

composer require abdallahmohammed/alsaad-notification-channel

接下来,您需要将配置选项添加到您的 config/services.php 配置文件中。您可以将下面的示例配置复制以开始操作

'alsaad' => [
    'from' => SENDER_NAME,
],

格式化通知

如果通知支持以 SMS 的形式发送,应在通知类中定义一个 toAlsaad 方法。此方法将接收一个 $notifiable 实体,并应返回一个 Illuminate\Notifications\Messages\AlsaadMessage 实例

/**
 * Get the SMS representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return AlsaadMessage
 */
public function toAlsaad($notifiable)
{
    return (new AlsaadMessage)
                ->content('Hello World');
}