This repository has been archived by the owner on May 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlugin.php
143 lines (131 loc) · 4.59 KB
/
Plugin.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
/** @noinspection PhpMissingParentCallCommonInspection */
declare(strict_types=1);
namespace Adrenth\CoffeeManager;
use Adrenth\CoffeeManager\Models\Participant;
use Adrenth\CoffeeManager\ServiceProviders\CoffeeManager;
use Backend\Helpers\Backend;
use Illuminate\Console\Scheduling\Schedule;
use System\Classes\PluginBase;
use Adrenth\CoffeeManager\Components;
use Adrenth\CoffeeManager\Console;
/**
* Class Plugin
*
* @package Adrenth\CoffeeManager
*/
class Plugin extends PluginBase
{
/**
* {@inheritdoc}
*/
public function pluginDetails(): array
{
return [
'name' => 'Adrenth.CoffeeManager',
'author' => 'A. Drenth <[email protected]>',
'icon' => 'icon-coffee',
'homepage' => 'http://github.com/adrenth',
];
}
/**
* {@inheritdoc}
*/
public function register(): void
{
$this->app->register(CoffeeManager::class);
$this->registerConsoleCommand('adrenth.coffeemanager.finish-rounds', Console\FinishRounds::class);
$this->registerConsoleCommand('adrenth.coffeemanager.serve-rounds', Console\ServeRounds::class);
}
/**
* @param Schedule $schedule
* @return void
*/
public function registerSchedule($schedule): void
{
$schedule->command(Console\FinishRounds::class)->everyMinute();
$schedule->command(Console\ServeRounds::class)->everyMinute();
}
/**
* {@inheritdoc}
*/
public function registerComponents(): array
{
return [
Components\Join::class => 'coffeeManagerJoin',
Components\Client::class => 'coffeeManagerClient',
Components\Profile::class => 'coffeeManagerProfile',
];
}
/**
* {@inheritdoc}
*/
public function registerPermissions(): array
{
return [
'adrenth.coffeemanager.access_groups' => [
'label' => 'Manage Groups',
'tab' => 'Coffee Manager',
'roles' => ['developer'],
],
'adrenth.coffeemanager.access_beverage_groups' => [
'label' => 'Manage Beverage Groups',
'tab' => 'Coffee Manager',
'roles' => ['developer'],
],
'adrenth.coffeemanager.access_beverages' => [
'label' => 'Manage Beverages',
'tab' => 'Coffee Manager',
'roles' => ['developer'],
],
'adrenth.coffeemanager.access_participants' => [
'label' => 'Manage Participants',
'tab' => 'Coffee Manager',
'roles' => ['developer'],
],
];
}
/**
* {@inheritdoc}
*/
public function registerNavigation(): array
{
/** @var Backend $backendHelper */
$backendHelper = resolve(Backend::class);
return [
'coffeemanager' => [
'label' => 'Coffee Manager',
'url' => $backendHelper->url('adrenth/coffeemanager/groups'),
'iconSvg' => '/plugins/adrenth/coffeemanager/assets/images/coffee.svg',
'permissions' => ['adrenth.coffeemanager.*'],
'order' => 500,
'sideMenu' => [
'groups' => [
'label' => 'Groups',
'icon' => 'icon-sitemap',
'url' => $backendHelper->url('adrenth/coffeemanager/groups'),
'permissions' => ['adrenth.coffeemanager.access_groups'],
],
'beverage-groups' => [
'label' => 'Beverage Groups',
'icon' => 'icon-sitemap',
'url' => $backendHelper->url('adrenth/coffeemanager/beveragegroups'),
'permissions' => ['adrenth.coffeemanager.access_beverage_groups'],
],
'beverages' => [
'label' => 'Beverages',
'icon' => 'icon-coffee',
'url' => $backendHelper->url('adrenth/coffeemanager/beverages'),
'permissions' => ['adrenth.coffeemanager.access_beverages'],
],
'participants' => [
'label' => 'Participants',
'icon' => 'icon-users',
'url' => $backendHelper->url('adrenth/coffeemanager/participants'),
'permissions' => ['adrenth.coffeemanager.access_participants'],
],
],
],
];
}
}