From accb0d8dc3f8c23961a4655ca531cc46a5e45c11 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Wed, 9 Oct 2024 08:19:50 +0100 Subject: [PATCH] Simplify service provider --- composer.json | 2 +- src/ServiceProvider.php | 23 ++++------------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index 17ed707..102c2e3 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "bashy/laravel-campaignmonitor": "^6.0", "laravel/framework": "^10.25.0 || ^11.0", "pixelfear/composer-dist-plugin": "^0.1", - "statamic/cms": "^5.18", + "statamic/cms": "^5.28", "stillat/proteus": "^4.0" }, "require-dev": { diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index cba53af..f787277 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -9,23 +9,12 @@ use Statamic\Facades\Permission; use Statamic\Providers\AddonServiceProvider; use Statamic\Support\Arr; -use StatamicRadPack\CampaignMonitor\Fieldtypes\CampaignMonitorCustomFields; -use StatamicRadPack\CampaignMonitor\Fieldtypes\CampaignMonitorFormFields; -use StatamicRadPack\CampaignMonitor\Fieldtypes\CampaignMonitorList; -use StatamicRadPack\CampaignMonitor\Fieldtypes\CampaignMonitorUserFields; use StatamicRadPack\CampaignMonitor\Listeners\AddFromSubmission; use StatamicRadPack\CampaignMonitor\Listeners\AddFromUser; use Stillat\Proteus\Support\Facades\ConfigWriter; class ServiceProvider extends AddonServiceProvider { - protected $fieldtypes = [ - CampaignMonitorCustomFields::class, - CampaignMonitorList::class, - CampaignMonitorFormFields::class, - CampaignMonitorUserFields::class, - ]; - protected $listen = [ UserRegistered::class => [AddFromUser::class], SubmissionCreated::class => [AddFromSubmission::class], @@ -41,10 +30,8 @@ class ServiceProvider extends AddonServiceProvider 'hotFile' => __DIR__.'/../dist/hot', ]; - public function boot() + public function bootAddon() { - parent::boot(); - Permission::extend(function () { Permission::register('manage campaign-monitor settings') ->label(__('Manage Campaign Monitor Settings')); @@ -60,12 +47,10 @@ public function boot() $this->addFormConfigFields(); - $this->app->booted(function () { - $this->migrateToFormConfig(); - $this->migrateUserToYaml(); + $this->migrateToFormConfig(); + $this->migrateUserToYaml(); - $this->addFormsToNewsletterConfig(); - }); + $this->addFormsToNewsletterConfig(); } private function addFormsToNewsletterConfig()