-
Notifications
You must be signed in to change notification settings - Fork 0
/
extend.php
41 lines (30 loc) · 1.35 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
39
40
41
<?php
namespace Nearata\MaintenanceMode;
use Flarum\Extend;
use Nearata\MaintenanceMode\Api\Controller\UpdateSettingController;
use Nearata\MaintenanceMode\Forum\Controller\AuthController;
use Nearata\MaintenanceMode\Api\Middleware\MaintenanceModeApiMiddleware;
use Nearata\MaintenanceMode\Console\AuthCommand;
use Nearata\MaintenanceMode\Console\ToggleCommand;
use Nearata\MaintenanceMode\Forum\Middleware\MaintenanceModeForumMiddleware;
return [
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js')
->css(__DIR__.'/less/admin.less'),
new Extend\Locales(__DIR__.'/locale'),
(new Extend\View)
->namespace('nearata.maintenance-mode', __DIR__.'/views'),
(new Extend\Middleware('forum'))
->add(MaintenanceModeForumMiddleware::class),
(new Extend\Middleware('api'))
->add(MaintenanceModeApiMiddleware::class),
(new Extend\Console)
->command(AuthCommand::class)
->command(ToggleCommand::class),
(new Extend\Routes('forum'))
->get('/nearata/maintenanceMode/auth/{token}', 'nearata-maintenance-mode.auth', AuthController::class),
(new Extend\Routes('api'))
->patch('/nearata/maintenanceMode/enabled', 'nearata-maintenance-mode.enabled', UpdateSettingController::class),
(new Extend\Settings)
->default('nearata-maintenance-mode.enabled', false)
];