PHP code example of james.xue / laravel-notification-channels

1. Go to this page and download the library: Download james.xue/laravel-notification-channels 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/ */

    

james.xue / laravel-notification-channels example snippets


composer 

php artisan make:vendor publish --tag=laravel-notification-channels

use Illuminate\Support\Facades\Notification;
use Vinhson\LaravelNotifications\Notifications\DingTalkNotification;

Notification::send($this, new DingTalkNotification($title, $message));
or 
Notification::send($this, new DingTalkNotification(message: $message));

class NotifyController extends Controller
{
    use Notifiable;

    public function index()
    {
        $user = User::factory()->create();

        $this->notify(new DingTalkNotification('通知', '【golang】姓名:' . $user->name . ' 邮箱:' . $user->email));

        config()->set('laravel-notifications.ding_talk.send_type', 'markdown');
        $data = "#### \n > golang】姓名:" . $user->name . " # 邮箱:" . $user->email;
        $this->notify(new DingTalkNotification('Markdown 通知', $data));

        return 'ok';
    }
}