mirror of
https://github.com/flarum/core.git
synced 2025-10-16 01:07:09 +02:00
More powerful/extensible notifications
- Notifications can be delivered in multiple ways (alert, email) - Different notification types can implement interfaces to allow themselves to be delivered in these various ways - User preferences for each notification type/method combination are automatically registered
This commit is contained in:
35
src/Core/Notifications/NotificationServiceProvider.php
Normal file
35
src/Core/Notifications/NotificationServiceProvider.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php namespace Flarum\Core\Notifications;
|
||||
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Flarum\Core\Models\User;
|
||||
|
||||
class NotificationServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Dispatcher $events)
|
||||
{
|
||||
$notifier = app('Flarum\Core\Notifications\Notifier');
|
||||
|
||||
$notifier->registerMethod('alert', 'Flarum\Core\Notifications\Senders\NotificationAlerter');
|
||||
$notifier->registerMethod('email', 'Flarum\Core\Notifications\Senders\NotificationEmailer');
|
||||
|
||||
$notifier->registerType('Flarum\Core\Notifications\Types\DiscussionRenamedNotification', ['alert' => true]);
|
||||
|
||||
$events->subscribe('Flarum\Core\Handlers\Events\DiscussionRenamedNotifier');
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'Flarum\Core\Repositories\NotificationRepositoryInterface',
|
||||
'Flarum\Core\Repositories\EloquentNotificationRepository'
|
||||
);
|
||||
|
||||
$this->app->singleton('Flarum\Core\Notifications\Notifier');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user