marshmallow/nova-alertable

Add alerts and modals to your Nova installation. After creating or updating any resource. Or after running an action. Whatever you need!


README

alt text

Nova Alertable

Version Issues Licence PHP Syntax Checker This Nova package will make it possible to sent alert to you Nova application via Model Observers. If you want to help the user to remember that they have to do an action after they've changed a resource, this package is for you!

Installation

Composer

You can install the package in to a Laravel app that uses Nova via composer:

composer require marshmallow/alertable

Nova

Add the tool to you NovaServiceProvider.

public function tools()
{
    return [
        // ...
        new \Marshmallow\Alertable\Alertable,
    ];
}

Routes

Make sure you have the alertable channel authenticated in routes/channels.php:

Broadcast::channel('alertable.{userId}', function ($user, $userId) {
    return $user->id === (int) $userId;
});

Pusher

This tool uses pusher to broadcast events. Please create a free pusher account if you don't have one already.

PUSHER_APP_ID=_____
PUSHER_APP_KEY=_____
PUSHER_APP_SECRET=_____
PUSHER_APP_CLUSTER=_____

We've run into issues before when useTLS is active in the broadcasting.php config file. If you run into issues, pleas comment this as shown in the example below.

'connections' => [
    'pusher' => [
        'driver' => 'pusher',
        'key' => env('PUSHER_APP_KEY'),
        'secret' => env('PUSHER_APP_SECRET'),
        'app_id' => env('PUSHER_APP_ID'),
        'options' => [
            'cluster' => env('PUSHER_APP_CLUSTER'),
            // 'useTLS' => true,
        ],
    ],
]

Also, make sure the BroadcastServiceProvider::class is uncommented in config/app.php.

Set your BROADCAST_DRIVER to pusher in your .env file.

BROADCAST_DRIVER=pusher

Usage

use Marshmallow\Alertable\Events\AlertNotificationEvent;

event(new AlertNotificationEvent(
    request()->user(),
    $alert_message = 'This Marshmallow Package is awesome!'
));

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

If you discover any security related issues, please email stef@marshmallow.dev instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.