webpress/notification

There is no license information available for the latest version (3.1.87) of this package.

Webpress additional notification functionalities package


README

Notification channel for laravel webpress core

Installation

To include the package in your project, Please run following command.

composer require webpress/notification

Configuration

Run the following commands to publish configuration and migration files.

php artisan vendor:publish --provider="VCComponent\Laravel\Notification\Providers\NotificationServiceProvider"

Environment

In .env file, we need some configuration.

// Communication microservice url
WEBPRESS_NOTIFICATION_BASE_URL=https://api.dev.webpress.vn/communication

Notification Channels

Webpress notification channel

A notification channel to support send email via Webpress Communication microservice (Currently using Mailchimp Transactional Api).

Use this channel in notification class similar to other default laravel notification channel.

use VCComponent\Laravel\Notification\Notifications\Channels\WebpressChannel;

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

Define the message in toWebpress() method.

use VCComponent\Laravel\Notification\Notifications\Messages\WebpressMessage;

public function toWebpress($notifiable)
{
    return (new WebpressMessage())
        ->to($notifiable->email)
        ->subject('Reset Password')
        ->template('WEBPRESS 01 - reset your password')
        ->mergeFields([
            [
                'name'    => 'RESET_PASSWORD_URL',
                'content' => "{$reset_password_url}?token={$this->token}",
            ],
        ]);
}

APIs List

Here is the list of APIs provided by the package.

Verb URI Action
GET /api/{namespace}/notification-setting/configable get configable notifications of user
GET /api/{namespace}/notification-setting get user notification settings
PUT /api/{namespace}/notification-setting/sync update user notification settings
------ ------ ------
GET /api/{namespace}/admin/notifications get list notifications
GET /api/{namespace}/admin/notifications/{id} get a notification
POST /api/{namespace}/admin/notifications create a notification
PUT /api/{namespace}/admin/notifications/{id} update a notification
DELETE /api/{namespace}/admin/notifications/{id} delete a notification
------ ------ ------
GET /api/{namespace}/admin/template-variables get list template variables
GET /api/{namespace}/admin/template-variables/{id} get a template variable
POST /api/{namespace}/admin/template-variables create a template variable
PUT /api/{namespace}/admin/template-variables/{id} update a template variable
DELETE /api/{namespace}/admin/template-variables/{id} delete a template variable
------ ------ ------
GET /api/{namespace}/admin/notification-setting/role/{role_id} get role notification settings
PUT /api/{namespace}/admin/notification-setting update role template variable