Skip to content

f2m2/request-notification-channel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Notification Channel

Used to send an application/x-www-form-urlencoded POST requests.

Installation

You can install the package via composer:

composer require f2m2/request-notifcation-channel

Usage

use F2M2\RequestNotification\RequestNotificationChannel;
use F2M2\RequestNotification\RequestNotificationMessage;
use Illuminate\Notifications\Notification;

class MyNotification extends Notification
{
    public function via($notifiable)
    {
        return [RequestNotificationChannel::class];
    }

    public function toRequestNotification($notifiable)
    {
        return RequestNotificationChannel::create()
            ->data([
               'data' => [
                   'property' => 'value'
               ]
            ])
            ->userAgent("Custom-User-Agent")
            ->header('X-Custom', 'Custom-Header');
    }
}

Add the routeNotificationForRequestNotification method to your Notifiable Model, which should return the URL where the notification will call the request.

public function routeNotificationForRequestNotification()
{
    return 'http://httpbin.org/post';
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages