@@ -41,13 +41,11 @@ public function __construct()
4141 */
4242 public function register (Panel $ panel ): void
4343 {
44- $ panelName = ucfirst ($ panel ->getId ());
45-
4644 // Discover all classes, even if directories do not exists — Filament already checks and skips those
47- $ panel ->discoverResources ($ this ->getPanelPath ( $ panelName , 'Resources ' ), $ this ->getPanelNamespace ( $ panelName , 'Resources ' ));
48- $ panel ->discoverPages ($ this ->getPanelPath ( $ panelName , 'Pages ' ), $ this ->getPanelNamespace ( $ panelName , 'Pages ' ));
49- $ panel ->discoverClusters ($ this ->getPanelPath ( $ panelName , 'Clusters ' ), $ this ->getPanelNamespace ( $ panelName , 'Clusters ' ));
50- $ panel ->discoverWidgets ($ this ->getPanelPath ( $ panelName , 'Widgets ' ), $ this ->getPanelNamespace ( $ panelName , 'Widgets ' ));
45+ $ panel ->discoverResources ($ this ->getClassPath ( 'Resources ' ), $ this ->getClassNamespace ( 'Resources ' ));
46+ $ panel ->discoverPages ($ this ->getClassPath ( 'Pages ' ), $ this ->getClassNamespace ( 'Pages ' ));
47+ $ panel ->discoverClusters ($ this ->getClassPath ( 'Clusters ' ), $ this ->getClassNamespace ( 'Clusters ' ));
48+ $ panel ->discoverWidgets ($ this ->getClassPath ( 'Widgets ' ), $ this ->getClassNamespace ( 'Widgets ' ));
5149 }
5250
5351 /**
@@ -66,28 +64,14 @@ public function getPath(?string $path = null): string
6664 return $ this ->basePath .($ path ? "/ $ path " : '' );
6765 }
6866
69- /**
70- * Get the absolute path to the panel directory for the specified class.
71- *
72- * @param string $panelName Panel name (e.g. `Admin`)
73- * @param string $classDir Class dir (e.g. `Resource`)
74- * @return string Absolute path for the specified class (e.g. `/app/vendor/eclipsephp/cms-plugin/src/Admin/Filament/Resource`)
75- */
76- protected function getPanelPath (string $ panelName , string $ classDir ): string
67+ protected function getClassPath (string $ classDir ): string
7768 {
78- return $ this ->getPath ('src ' )."/ $ panelName / Filament/$ classDir " ;
69+ return $ this ->getPath ('src ' )."/Filament/ $ classDir " ;
7970 }
8071
81- /**
82- * Get the full panel namespace for the specified class.
83- *
84- * @param string $panelName Panel name (e.g. `Admin`)
85- * @param string $classDir Class dir (e.g. `Resource`)
86- * @return string Full namespace for the specified class (e.g. `Eclipse\Cms\Admin\Resource`)
87- */
88- protected function getPanelNamespace (string $ panelName , string $ classDir ): string
72+ protected function getClassNamespace (string $ classDir ): string
8973 {
90- return "$ this ->pluginNamespace \\$ panelName \\ Filament \\$ classDir " ;
74+ return "$ this ->pluginNamespace \\Filament \\$ classDir " ;
9175 }
9276
9377 /**
0 commit comments