-
Notifications
You must be signed in to change notification settings - Fork 2
/
extend.php
26 lines (22 loc) · 937 Bytes
/
extend.php
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
<?php
namespace ClarkWinkelmann\Mailing;
use Flarum\Api\Serializer\ForumSerializer;
use Flarum\Extend;
return [
(new Extend\Frontend('forum'))
->js(__DIR__ . '/js/dist/forum.js')
->css(__DIR__ . '/resources/less/forum.less'),
(new Extend\Frontend('admin'))
->js(__DIR__ . '/js/dist/admin.js'),
new Extend\Locales(__DIR__ . '/resources/locale'),
(new Extend\Routes('api'))
->post('/admin-mail', 'kilowhat.mailing.create-mail', Controllers\SendAdminEmailController::class),
(new Extend\ApiSerializer(ForumSerializer::class))
->attributes(function (ForumSerializer $serializer): array {
$actor = $serializer->getActor();
return [
'kilowhatMailingCanMailAll' => $actor->can('kilowhat-mailing.mail-all'),
'kilowhatMailingCanMailIndividual' => $actor->can('kilowhat-mailing.mail-individual'),
];
}),
];