Skip to content

Commit

Permalink
Fix migration error (#65)
Browse files Browse the repository at this point in the history
* Fix

* removeSection or removeTab
  • Loading branch information
martink635 authored Apr 14, 2024
1 parent ba58a8e commit 3419507
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/Commands/MigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ public function handle(File $file)
});

$blueprintsWithSeotamicFields = $blueprints->filter(function ($blueprint) {
return $blueprint->hasSection('SEO') || $blueprint->hasSection('Social');
if (method_exists($blueprint, 'hasSection')) {
return $blueprint->hasSection('SEO') || $blueprint->hasSection('Social');
}

if (method_exists($blueprint, 'hasTab')) {
return $blueprint->hasTab('SEO') || $blueprint->hasTab('Social');
}
});

$skippedBlueprints = [];
Expand All @@ -65,8 +71,17 @@ public function handle(File $file)

if ($this->confirm('Do you want to remove the SEOtamic fields from this blueprint?', true)) {
$this->info('Removing SEOtamic fields from blueprint: ' . $blueprint->handle());
$blueprint->removeSection('SEO');
$blueprint->removeSection('Social');

if (method_exists($blueprint, 'removeSection')) {
$blueprint->removeSection('SEO');
$blueprint->removeSection('Social');
}

if (method_exists($blueprint, 'removeTab')) {
$blueprint->removeTab('SEO');
$blueprint->removeTab('Social');
}

$blueprint->save();
} else {
$this->info('Skipping blueprint: ' . $blueprint->handle());
Expand Down

0 comments on commit 3419507

Please sign in to comment.