Skip to content

Commit

Permalink
Campaign Export now loads module settings
Browse files Browse the repository at this point in the history
  • Loading branch information
spitfire305 committed Apr 29, 2024
1 parent b6fb000 commit 6aa7223
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions app/Services/Campaign/Import/ImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Enums\CampaignImportStatus;
use App\Models\CampaignImport;
use App\Models\CampaignSetting;
use App\Notifications\Header;
use App\Services\Campaign\Import\Mappers\AbilityMapper;
use App\Services\Campaign\Import\Mappers\CalendarMapper;
Expand Down Expand Up @@ -158,6 +159,7 @@ protected function process()
{
try {
$this->importCampaign()
->moduleSettings()
->gallery()
->entities()
->secondCampaign()
Expand Down Expand Up @@ -252,6 +254,26 @@ protected function gallery(): self
return $this;
}

protected function moduleSettings(): self
{
// Open the campaign settings file
$data = $this->open('settings/modules.json');

if (!$data) {
return $this;
}

$moduleSettings = $this->campaign->setting;

foreach ($data as $module => $settings) {
if (isset($moduleSettings->$module)) {
$moduleSettings->$module = $settings['enabled'];
}
}
$moduleSettings->save();

return $this;
}

protected function entities(): self
{
Expand Down

0 comments on commit 6aa7223

Please sign in to comment.