6
6
use Illuminate \Database \Eloquent \Model ;
7
7
use Statikbe \FilamentFlexibleContentBlockPages \Facades \FilamentFlexibleContentBlockPages ;
8
8
use Statikbe \FilamentFlexibleContentBlockPages \Models \Page ;
9
+ use Statikbe \FilamentFlexibleContentBlockPages \Models \TagType ;
9
10
10
11
class SeedDefaultsCommand extends Command
11
12
{
@@ -32,6 +33,7 @@ public function handle(): void
32
33
33
34
$ this ->seedHomePage ();
34
35
$ this ->seedSettings ();
36
+ $ this ->seedTagTypes ();
35
37
36
38
$ this ->info ('Default home page and settings seeded successfully! ' );
37
39
}
@@ -69,4 +71,32 @@ private function setTranslatedField(Model $model, string $field, string $value,
69
71
$ model ->setTranslation ($ field , $ locale , $ value );
70
72
}
71
73
}
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
+ }
72
102
}
0 commit comments