PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 2.21.0
GiveWP – Donation Plugin and Fundraising Platform v2.21.0
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / Subscriptions / ServiceProvider.php

ServiceProvider.php in GiveWP – Donation Plugin and Fundraising Platform 2.21.0, at src/Subscriptions/ServiceProvider.php

44 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Subscriptions;
4
5 use Give\Framework\Migrations\MigrationsRegister;
6 use Give\Helpers\Hooks;
7 use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface;
8 use Give\Subscriptions\LegacyListeners\DispatchGiveSubscriptionPostCreate;
9 use Give\Subscriptions\LegacyListeners\DispatchGiveSubscriptionPreCreate;
10 use Give\Subscriptions\Migrations\CreateSubscriptionTables;
11 use Give\Subscriptions\Repositories\SubscriptionRepository;
12
13 class ServiceProvider implements ServiceProviderInterface
14 {
15 /**
16 * @inheritDoc
17 */
18 public function register()
19 {
20 give()->singleton('subscriptions', SubscriptionRepository::class);
21 }
22
23 /**
24 * @inheritDoc
25 */
26 public function boot()
27 {
28 $this->bootLegacyListeners();
29
30 give(MigrationsRegister::class)->addMigration(CreateSubscriptionTables::class);
31 }
32
33 /**
34 * Legacy Listeners
35 *
36 * @since 2.19.6
37 */
38 private function bootLegacyListeners()
39 {
40 Hooks::addAction('givewp_subscription_creating', DispatchGiveSubscriptionPreCreate::class);
41 Hooks::addAction('givewp_subscription_created', DispatchGiveSubscriptionPostCreate::class);
42 }
43 }
44