File tree Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Filament \Contracts \Plugin ;
6
6
use Filament \Panel ;
7
+ use Nwidart \Modules \Module ;
7
8
use TomatoPHP \FilamentTypes \Resources \TypeResource ;
8
9
use Filament \SpatieLaravelTranslatablePlugin ;
9
10
10
11
11
12
class FilamentTypesPlugin implements Plugin
12
13
{
14
+ private bool $ isActive = false ;
15
+
13
16
public function getId (): string
14
17
{
15
18
return 'filament-types ' ;
16
19
}
17
20
18
21
public function register (Panel $ panel ): void
19
22
{
20
- $ panel
21
- ->plugin (
22
- SpatieLaravelTranslatablePlugin::make ()
23
- ->defaultLocales (['en ' , 'ar ' ]),
24
- )
25
- ->resources ([
26
- TypeResource::class
27
- ]);
23
+ if (class_exists (Module::class)){
24
+ if (\Nwidart \Modules \Facades \Module::find ('FilamentTypes ' )->isEnabled ()){
25
+ $ this ->isActive = true ;
26
+ }
27
+ }
28
+ else {
29
+ $ this ->isActive = true ;
30
+ }
31
+
32
+ if ($ this ->isActive ) {
33
+ $ panel
34
+ ->plugin (
35
+ SpatieLaravelTranslatablePlugin::make ()
36
+ ->defaultLocales (['en ' , 'ar ' ]),
37
+ )
38
+ ->resources ([
39
+ TypeResource::class
40
+ ]);
41
+ }
28
42
29
43
}
30
44
You can’t perform that action at this time.
0 commit comments