-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.php
More file actions
34 lines (29 loc) · 1.17 KB
/
module.php
File metadata and controls
34 lines (29 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
declare(strict_types=1);
use Marko\Core\Container\ContainerInterface;
use Marko\Database\Connection\ConnectionInterface;
use Marko\Mail\Contracts\MailerInterface;
use Marko\Notification\Channel\DatabaseChannel;
use Marko\Notification\Channel\MailChannel;
use Marko\Notification\Config\NotificationConfig;
use Marko\Notification\NotificationManager;
use Marko\Notification\NotificationSender;
return [
'enabled' => true,
'bindings' => [
NotificationConfig::class => NotificationConfig::class,
NotificationManager::class => NotificationManager::class,
NotificationSender::class => NotificationSender::class,
],
'boot' => function (ContainerInterface $container) {
$manager = $container->get(NotificationManager::class);
// Register mail channel if mailer is available
if ($container->has(MailerInterface::class)) {
$manager->register('mail', $container->get(MailChannel::class));
}
// Register database channel if connection is available
if ($container->has(ConnectionInterface::class)) {
$manager->register('database', $container->get(DatabaseChannel::class));
}
},
];