PHP code example of ywmelo / subscribe-message

1. Go to this page and download the library: Download ywmelo/subscribe-message library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ywmelo / subscribe-message example snippets


namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use MobilenowGroup\Message\WechatSubScribeMessage;
use Ywmelo\Channels\WechatSubscribeMessageChannel;

class WechatSubScribeMessageNotification extends Notification
{
    use Queueable;

    public function via($notifiable)
    {
        return [WechatSubscribeMessageChannel::class];
    }

    public function toWechatSubscribeMessage($notifiable)
    {
        return (new WechatSubscribeMessage)
            ->setTemplateId('template_id')
            ->setPage('page')
            ->setData([
                'keyword1' => 'keyword1',
                'keyword2' => 'keyword2',
                'keyword3' => 'keyword3',
                'keyword4' => 'keyword4',
            ]);
    }
}

$user->notify(new WechatSubscribeMessageNotification($formId));