4
4
5
5
use DutchCodingCompany \FilamentDeveloperLogins \Livewire \MenuLogins ;
6
6
use DutchCodingCompany \FilamentDeveloperLogins \View \Components \DeveloperLogins ;
7
+ use Filament \Panel ;
7
8
use Filament \Facades \Filament ;
8
9
use Filament \Support \Concerns \EvaluatesClosures ;
9
10
use Filament \Support \Facades \FilamentView ;
@@ -45,7 +46,8 @@ public function packageBooted(): void
45
46
protected static function registerRenderHooks (): void
46
47
{
47
48
$ panel = Filament::getCurrentPanel ();
48
- if (is_null ($ panel ) || ! $ panel ->hasPlugin ('filament-developer-logins ' )) {
49
+
50
+ if (! self ::enabledForPanel ($ panel )) {
49
51
return ;
50
52
}
51
53
@@ -55,7 +57,8 @@ protected static function registerRenderHooks(): void
55
57
FilamentView::registerRenderHook (
56
58
PanelsRenderHook::AUTH_LOGIN_FORM_AFTER ,
57
59
static function () use ($ plugin ) : ?string {
58
- if (! $ plugin ->getEnabled ()) {
60
+
61
+ if (! $ plugin ->getEnabled () || ! self ::enabledForPanel (Filament::getCurrentPanel ())) {
59
62
return null ;
60
63
}
61
64
@@ -66,12 +69,17 @@ static function () use ($plugin) : ?string {
66
69
FilamentView::registerRenderHook (
67
70
PanelsRenderHook::GLOBAL_SEARCH_AFTER ,
68
71
static function () use ($ plugin ) : ?string {
69
- if (! $ plugin ->getEnabled () || ! $ plugin ->getSwitchable ()) {
72
+ if (! $ plugin ->getEnabled () || ! $ plugin ->getSwitchable () || ! self :: enabledForPanel (Filament:: getCurrentPanel ()) ) {
70
73
return null ;
71
74
}
72
75
73
76
return Blade::render ('@livewire( \'menu-logins \') ' );
74
77
},
75
78
);
76
79
}
80
+
81
+ protected static function enabledForPanel (?Panel $ panel )
82
+ {
83
+ return ! is_null ($ panel ) && $ panel ->hasPlugin ('filament-developer-logins ' );
84
+ }
77
85
}
0 commit comments