-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextend.php
executable file
·38 lines (30 loc) · 1.57 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
38
<?php
use Flarum\Extend;
use Flarum\Api\Serializer\ForumSerializer;
use Ziven\transferMoney\Controller\ListTransferMoneyHistoryController;
use Ziven\transferMoney\Controller\TransferMoneyController;
use Ziven\transferMoney\Notification\TransferMoneyBlueprint;
use Ziven\transferMoney\Serializer\TransferMoneySerializer;
use Ziven\transferMoney\Gambits\AllowsPdGambit;
use Flarum\User\Search\UserSearcher;
use Flarum\User\User;
$extend = [
(new Extend\Frontend('admin'))->js(__DIR__.'/js/dist/admin.js'),
(new Extend\Frontend('forum'))->js(__DIR__ . '/js/dist/forum.js')->css(__DIR__.'/less/forum.less'),
(new Extend\Locales(__DIR__ . '/locale')),
(new Extend\ApiSerializer(ForumSerializer::class))
->attribute('allowUseTranferMoney', function (ForumSerializer $serializer) {
return $serializer->getActor()->hasPermission("transferMoney.allowUseTranferMoney");
}),
(new Extend\Routes('api'))
->post('/transferMoney', 'money.transfer', TransferMoneyController::class)
->get('/transferHistory', 'money.history', ListTransferMoneyHistoryController::class),
(new Extend\Notification())
->type(TransferMoneyBlueprint::class, TransferMoneySerializer::class, ['alert']),
(new Extend\SimpleFlarumSearch(UserSearcher::class))
->addGambit(AllowsPdGambit::class),
(new Extend\Settings())
->serializeToForum('moneyTransferClient1Customization', 'moneyTransfer.moneyTransferClient1Customization')
->serializeToForum('moneyTransferTimeZone', 'moneyTransfer.moneyTransferTimeZone'),
];
return $extend;