-
Notifications
You must be signed in to change notification settings - Fork 12
/
Plugin.php
62 lines (55 loc) · 1.88 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
<?php namespace OFFLINE\Cashier;
use Illuminate\Support\Facades\App;
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 RainLab\User\Models\User;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
public $require = ['RainLab.User'];
public function boot()
{
App::register(CashierServiceProvider::class);
if (class_exists(User::class)) {
User::extend(static function ($user) {
$user->implement[] = 'OFFLINE.Cashier.Classes.Billable';
});
}
}
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'],
],
];
}
}