Skip to content

Commit

Permalink
Simplify service provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Oct 9, 2024
1 parent 6e2077c commit accb0d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
23 changes: 4 additions & 19 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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'));
Expand All @@ -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()
Expand Down

0 comments on commit accb0d8

Please sign in to comment.