Skip to content

Commit 828e970

Browse files
committed
Seeder tag types
1 parent 3a3106b commit 828e970

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

resources/lang/en/filament-flexible-content-block-pages.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
'icon_lbl' => 'Icon',
4444
],
4545
'tag_types' => [
46-
'navigation_group' => 'Tags',
46+
'navigation_group' => 'Settings',
4747
'tag_type_plural_lbl' => 'Tag types',
4848
'tag_type_lbl' => 'Tag type',
4949
'tag_type_is_default_type_lbl' => 'Is default tag type',
5050
],
5151
'tags' => [
52-
'navigation_group' => 'Tags',
52+
'navigation_group' => 'Settings',
5353
'tag_plural_lbl' => 'Tags',
5454
'tag_lbl' => 'Tag',
5555
],

resources/lang/nl/filament-flexible-content-block-pages.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
'icon_lbl' => 'Icoon',
4444
],
4545
'tag_types' => [
46-
'navigation_group' => 'Tags',
46+
'navigation_group' => 'Instellingen',
4747
'tag_type_plural_lbl' => 'Tagtypes',
4848
'tag_type_lbl' => 'Tagtype',
4949
'tag_type_is_default_type_lbl' => 'Is standaard tagtype',
5050
],
5151
'tags' => [
52-
'navigation_group' => 'Tags',
52+
'navigation_group' => 'Instellingen',
5353
'tag_plural_lbl' => 'Tags',
5454
'tag_lbl' => 'Tag',
5555
],

src/Commands/SeedDefaultsCommand.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Database\Eloquent\Model;
77
use Statikbe\FilamentFlexibleContentBlockPages\Facades\FilamentFlexibleContentBlockPages;
88
use Statikbe\FilamentFlexibleContentBlockPages\Models\Page;
9+
use Statikbe\FilamentFlexibleContentBlockPages\Models\TagType;
910

1011
class SeedDefaultsCommand extends Command
1112
{
@@ -32,6 +33,7 @@ public function handle(): void
3233

3334
$this->seedHomePage();
3435
$this->seedSettings();
36+
$this->seedTagTypes();
3537

3638
$this->info('Default home page and settings seeded successfully!');
3739
}
@@ -69,4 +71,32 @@ private function setTranslatedField(Model $model, string $field, string $value,
6971
$model->setTranslation($field, $locale, $value);
7072
}
7173
}
74+
75+
private function seedTagTypes()
76+
{
77+
$locales = FilamentFlexibleContentBlockPages::config()->getSupportedLocales();
78+
$tagTypeModel = FilamentFlexibleContentBlockPages::config()->getTagTypeModel();
79+
80+
if (! $tagTypeModel::code(TagType::TYPE_DEFAULT)->exists()) {
81+
$seoType = new $tagTypeModel;
82+
$seoType->code = TagType::TYPE_DEFAULT;
83+
$this->setTranslatedField($seoType, 'name', 'Standaard', $locales);
84+
$seoType->color = '#4FC3F7';
85+
$seoType->icon = 'heroicon-s-tag';
86+
$seoType->is_default_type = true;
87+
$seoType->has_seo_pages = false;
88+
$seoType->save();
89+
}
90+
91+
if (! $tagTypeModel::code(TagType::TYPE_SEO)->exists()) {
92+
$seoType = new $tagTypeModel;
93+
$seoType->code = TagType::TYPE_SEO;
94+
$this->setTranslatedField($seoType, 'name', "Alleen voor SEO-pagina's", $locales);
95+
$seoType->color = '#FFC107';
96+
$seoType->icon = 'heroicon-s-alt-globe';
97+
$seoType->is_default_type = false;
98+
$seoType->has_seo_pages = true;
99+
$seoType->save();
100+
}
101+
}
72102
}

0 commit comments

Comments
 (0)