66use Illuminate \Database \Eloquent \Model ;
77use Statikbe \FilamentFlexibleContentBlockPages \Facades \FilamentFlexibleContentBlockPages ;
88use Statikbe \FilamentFlexibleContentBlockPages \Models \Page ;
9+ use Statikbe \FilamentFlexibleContentBlockPages \Models \TagType ;
910
1011class 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