-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPlugin.php
70 lines (63 loc) · 2.38 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
<?php
namespace PlanetaDelEste\ApiShopaholic;
use Event;
use Illuminate\Contracts\Http\Kernel;
use PlanetaDelEste\ApiShopaholic\Classes\Event\ApiShopaholicHandle;
use PlanetaDelEste\ApiShopaholic\Classes\Event\Brand\BrandModelHandler;
use PlanetaDelEste\ApiShopaholic\Classes\Event\Category\CategoryModelHandler;
use PlanetaDelEste\ApiShopaholic\Classes\Event\ExtendElementCollection;
use PlanetaDelEste\ApiShopaholic\Classes\Event\LoggedUser\LoggedUserModelHandler;
use PlanetaDelEste\ApiShopaholic\Classes\Event\Property\ExtendPropertyCollection;
use PlanetaDelEste\ApiShopaholic\Classes\Event\Tax\TaxModelHandler;
use PlanetaDelEste\ApiShopaholic\Classes\Event\User\UserModelHandler;
use PlanetaDelEste\ApiShopaholic\Classes\Middleware\RefreshLoggedUserMiddleware;
use System\Classes\PluginBase;
/**
* ApiShopaholic Plugin Information File
*/
class Plugin extends PluginBase
{
public const EVENT_ITEMRESOURCE_DATA = 'planetadeleste.apishopaholic.resource.itemData';
public const EVENT_LOCALE_BEFORE_CHANGE = 'planetadeleste.apishopaholic.locale.beforeChange';
public const EVENT_LOCALE_AFTER_CHANGE = 'planetadeleste.apishopaholic.locale.afterChange';
public const API_ROUTES = '/planetadeleste/apishopaholic/routes/';
public $require = [
'Lovata.Shopaholic',
'Lovata.Buddies',
'PlanetaDelEste.BuddiesGroup',
'PlanetaDelEste.ApiToolbox'
];
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails(): array
{
return [
'name' => 'ApiShopaholic',
'description' => 'No description provided yet...',
'author' => 'PlanetaDelEste',
'icon' => 'icon-leaf'
];
}
public function boot(): void
{
$this->subscribeEvents();
$this->app[Kernel::class]->pushMiddleware(RefreshLoggedUserMiddleware::class);
}
protected function subscribeEvents(): void
{
$arEvents = [
ExtendElementCollection::class,
ExtendPropertyCollection::class,
UserModelHandler::class,
CategoryModelHandler::class,
BrandModelHandler::class,
ApiShopaholicHandle::class,
TaxModelHandler::class,
LoggedUserModelHandler::class,
];
array_walk($arEvents, [Event::class, 'subscribe']);
}
}