Looking to hire Laravel developers? Try LaraJobs

laravel-td-notification-channel maintained by mkohei

Description
Treasure Data Notification Channel for Laravel
Last update
2023/04/20 08:33 (2.x-dev)
License
Links
Downloads
16 008

Comments
comments powered by Disqus

Treasure Data notifications channel for Laravel

tests StyleCI

This package makes it easy to send Treasure Data using the Laravel notification system and the Treasure Data Postback API.

Contents

Installation

composer require mkohei/laravel-td-notification-channel

Usage

Now you can use the channel in your via() method inside the notification:

use Mkohei\LaravelTdNotificationChannel\TreasureDataChannel;
use Mkohei\LaravelTdNotificationChannel\TreasureDataMessage;
use Illuminate\Notifications\Notification;

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

    public function toTreasureData($notifiable)
    {
        return TreasureDataMessage::create()
            ->data([
               'param1' => 'value',
               'param2' => 1234,
            ])
            ->apikey('YOUR_WRITE_ONLY_KEY')
            ->database('your_db')
            ->table('your_table');
    }
}

To store notifications in the appropriate regions, databases, and tables, define a routeNotificationForTreasureData method on your notifiable entity. This should return the Postback API endpoint for your region.

public function routeNotificationForTreasureData()
{
    return 'https://in.treasuredata.com';
}

Testing

composer test

License

MIT License.