This repository has been archived by the owner on Jul 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
extend.php
42 lines (39 loc) · 1.91 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
42
<?php
/*
* This file is part of reflar/polls.
*
* Copyright (c) ReFlar.
*
* https://reflar.redevs.org
*
* For the full copyright and license information, please view the license.md
* file that was distributed with this source code.
*/
namespace Reflar\Polls;
use Flarum\Extend;
use Illuminate\Contracts\Events\Dispatcher;
use Reflar\Polls\Api\Controllers;
return [
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js'),
(new Extend\Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js')
->css(__DIR__.'/resources/less/forum.less')
->css(__DIR__.'/resources/css/dist/DateTimePicker.min.css'),
new Extend\Locales(__DIR__.'/resources/locale'),
(new Extend\Routes('api'))
->get('/reflar/polls', 'polls.index', Controllers\ListPollController::class)
->patch('/reflar/polls/{id}', 'polls.update', Controllers\UpdatePollController::class)
->patch('/reflar/polls/{id}/endDate', 'polls.endDate.update', Controllers\UpdateEndDateController::class)
->delete('/reflar/polls/{id}', 'polls.delete', Controllers\DeletePollController::class)
->get('/reflar/polls/votes', 'polls.votes.index', Controllers\ListVotesController::class)
->post('/reflar/polls/votes', 'polls.votes.create', Controllers\CreateVoteController::class)
->patch('/reflar/polls/votes/{id}', 'polls.votes.update', Controllers\UpdateVoteController::class)
->post('/reflar/polls/answers', 'polls.answers.create', Controllers\CreateAnswerController::class)
->patch('/reflar/polls/answers/{id}', 'polls.answers.update', Controllers\UpdateAnswerController::class)
->delete('/reflar/polls/answers/{id}', 'polls.answers.delete', Controllers\DeleteAnswerController::class),
function (Dispatcher $events) {
$events->subscribe(Listeners\AddDiscussionPollRelationship::class);
$events->subscribe(Listeners\SavePollToDatabase::class);
},
];