2
2
3
3
namespace Statikbe \FilamentFlexibleContentBlockPages ;
4
4
5
+ use Filament \Resources \Resource ;
5
6
use Statikbe \FilamentFlexibleContentBlockPages \Models \Page ;
7
+ use Statikbe \FilamentFlexibleContentBlockPages \Models \Redirect ;
8
+ use Statikbe \FilamentFlexibleContentBlockPages \Models \Settings ;
6
9
7
10
class FilamentFlexibleContentBlockPagesConfig
8
11
{
12
+ const TYPE_PAGE = 'pages ' ;
13
+
14
+ const TYPE_REDIRECT = 'redirects ' ;
15
+
16
+ const TYPE_SETTINGS = 'settings ' ;
17
+
18
+ const TYPE_AUTHOR = 'authors ' ;
19
+
9
20
private string $ pageModel ;
10
21
22
+ private string $ redirectModel ;
23
+
24
+ private string $ settingsModel ;
25
+
11
26
public function __construct ()
12
27
{
13
28
$ this ->pageModel = $ this ->packageConfig ('models.page ' , Page::class);
29
+ $ this ->redirectModel = $ this ->packageConfig ('models.redirect ' , \Statikbe \FilamentFlexibleContentBlockPages \Models \Redirect::class);
30
+ $ this ->settingsModel = $ this ->packageConfig ('models.settings ' , \Statikbe \FilamentFlexibleContentBlockPages \Models \Settings::class);
14
31
}
15
32
16
33
public function getPageModel (): Page
17
34
{
18
35
return app ($ this ->pageModel );
19
36
}
20
37
38
+ public function getRedirectModel (): Redirect
39
+ {
40
+ return app ($ this ->redirectModel );
41
+ }
42
+
43
+ public function getSettingsModel (): Settings
44
+ {
45
+ return app ($ this ->settingsModel );
46
+ }
47
+
21
48
public function getAuthorsTable (): string
22
49
{
23
50
return $ this ->packageConfig ('table_names.authors ' , 'users ' );
@@ -28,6 +55,16 @@ public function getPagesTable(): string
28
55
return $ this ->packageConfig ('table_names.pages ' , 'pages ' );
29
56
}
30
57
58
+ public function getRedirectsTable (): string
59
+ {
60
+ return $ this ->packageConfig ('table_names.redirects ' , 'redirects ' );
61
+ }
62
+
63
+ public function getSettingsTable (): string
64
+ {
65
+ return $ this ->packageConfig ('table_names.settings ' , 'settings ' );
66
+ }
67
+
31
68
/**
32
69
* @return array<class-string<resource>>
33
70
*/
@@ -41,6 +78,11 @@ public function getPanelPath(): string
41
78
return $ this ->packageConfig ('panel.path ' , 'content ' );
42
79
}
43
80
81
+ public function getSEODefaultCanonicalLocale (): string
82
+ {
83
+ return $ this ->packageConfig ('seo.default_canonical_locale ' , 'en ' );
84
+ }
85
+
44
86
private function packageConfig (string $ configKey , $ default = null ): mixed
45
87
{
46
88
return config ('filament-flexible-content-block-pages. ' .$ configKey );
0 commit comments