Bogardo / Mailgun

Mailgun package for Laravel
MIT License
295 stars 116 forks source link

Mailgun custom notification channel #163

Open Giacomo92 opened 4 years ago

Giacomo92 commented 4 years ago

How can i use this package as custom notification channel?

Something like this:

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use App\Channels\VoiceChannel;
use App\Channels\Messages\VoiceMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;

class InvoicePaid extends Notification
{
    use Queueable;

    /**
     * Get the notification channels.
     *
     * @param  mixed  $notifiable
     * @return array|string
     */
    public function via($notifiable)
    {
        return [MailgunChannel::class];
    }

    /**
     * Get the voice representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return VoiceMessage
     */
    public function toMailgun($notifiable)
    {
        // ...
    }
}