66use Eclipse \Core \Console \Commands \DeployCommand ;
77use Eclipse \Core \Console \Commands \PostComposerInstall ;
88use Eclipse \Core \Console \Commands \PostComposerUpdate ;
9- use Eclipse \Core \Models \User ;
10- use Eclipse \Core \Policies \UserPolicy ;
119use Eclipse \Core \Providers \AdminPanelProvider ;
12- use Illuminate \Support \Facades \Gate ;
13- use Illuminate \Support \Str ;
1410use Spatie \LaravelPackageTools \Package ;
1511use Spatie \LaravelPackageTools \PackageServiceProvider ;
1612
@@ -25,7 +21,9 @@ public function configurePackage(Package $package): void
2521 PostComposerInstall::class,
2622 PostComposerUpdate::class,
2723 ])
28- ->hasConfigFile ('eclipse ' )
24+ ->hasConfigFile ([
25+ 'eclipse ' ,
26+ ])
2927 ->discoversMigrations ()
3028 ->runsMigrations ()
3129 ->hasTranslations ();
@@ -37,39 +35,8 @@ public function register()
3735
3836 require_once __DIR__ .'/Helpers/helpers.php ' ;
3937
40- if ($ this ->isPanelRequest ()) {
41- $ this ->app ->register (AdminPanelProvider::class);
42- }
43-
44- return $ this ;
45- }
46-
47- public function boot ()
48- {
49- parent ::boot ();
50-
51- // Manually register user policy, since it can't be auto-discovered in the current setup
52- Gate::policy (User::class, UserPolicy::class);
38+ $ this ->app ->register (AdminPanelProvider::class);
5339
5440 return $ this ;
5541 }
56-
57- protected function isPanelRequest (): bool
58- {
59- if (Str::startsWith (request ()->path (), 'admin ' )) {
60- return true ;
61- }
62-
63- // If the request Referer header contains the admin path, return true
64- if (Str::contains (request ()->header ('referer ' ), 'admin ' )) {
65- return true ;
66- }
67-
68- // If running tests, always return true to make the panel available
69- if ($ this ->app ->runningInConsole () && config ('app.env ' ) === 'testing ' ) {
70- return true ;
71- }
72-
73- return false ;
74- }
7542}
0 commit comments