forked from OFFLINE-GmbH/oc-cashier-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plugin.php
67 lines (60 loc) · 1.96 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
<?php namespace OFFLINE\Cashier;
use App;
use Config;
use Laravel\Cashier\Cashier;
use Laravel\Cashier\CashierServiceProvider;
use OFFLINE\Cashier\Components\InvoicesList;
use OFFLINE\Cashier\Components\NeedsSubscription;
use OFFLINE\Cashier\Components\StripeElementsForm;
use OFFLINE\Cashier\Models\Settings;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
public $require = ['Rainlab.User'];
public function boot()
{
App::register(CashierServiceProvider::class);
Cashier::useCurrency(
Settings::get('currency_currency', 'USD'),
Settings::get('currency_symbol', '$')
);
}
public function register()
{
App::singleton('user.auth', function () {
return \OFFLINE\Cashier\Classes\AuthManager::instance();
});
}
public function registerComponents()
{
return [
StripeElementsForm::class => 'stripeElementsForm',
NeedsSubscription::class => 'needsSubscription',
InvoicesList::class => 'invoicesList',
];
}
public function registerPermissions()
{
return [
'offline.cashier.manage_settings' => [
'tab' => 'offline.cashier::lang.plugin.name',
'label' => 'offline.cashier::lang.plugin.manage_settings_permission',
],
];
}
public function registerSettings()
{
return [
'config' => [
'label' => 'offline.cashier::lang.plugin.name',
'description' => 'offline.cashier::lang.plugin.manage_settings',
'category' => 'system::lang.system.categories.cms',
'icon' => 'icon-money',
'class' => 'Offline\Cashier\Models\Settings',
'order' => 500,
'keywords' => 'cashier',
'permissions' => ['offline.cashier.manage_settings'],
],
];
}
}