john-wink / jw-notifications
Filament Plugin for customizable Notification Channels per User
Fund package maintenance!
john-wink
Requires
- php: ^8.1
- filament/filament: ^3.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
With this Plugin you can customize the Notifications Channel per User
Installation
You can install the package via composer:
composer require john-wink/jw-notifications
You can publish and run the migrations with:
php artisan vendor:publish --tag="jw-notifications-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="jw-notifications-config"
Optionally, you can publish the views using
php artisan vendor:publish --tag="jw-notifications-views"
This is the contents of the published config file:
return [ 'table' => 'subscribed_channels', 'notifiable' => App\Models\User::class, ];
Usage
Replace the via() function within Notifications that you want to use with this trait:
use \JohnWink\JwNotifications\Traits\HasCustomizedChannels;
Add the following trait to the user:
use \JohnWink\JwNotifications\Traits\CanSubscribeToChannels;
Configure the FilamentPanels according to this example: Replace the notifications with your own notifications and the channels with your own channels that you have installed and configured.
return $panel->plugins([ JwNotificationsPlugin::make() ->notifications([ /* * Add here your Notifications Channels * The Notification Channel should use the Trait: * \JohnWink\JwNotifications\Traits\HasCustomizedChannels */ ]) ->channels(fn () => [ 'database' => 'Database', 'mail' => 'Email', ]), ]);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.