@@ -65,10 +65,14 @@ public function packageRegistered(): void
65
65
public function attemptToRegisterModuleProviders (): void
66
66
{
67
67
// It is necessary to register them here to avoid late registration (after Panels have already been booted)
68
- $ pattern1 = config ('modules.paths.modules ' ,
69
- 'Modules ' ).'/* ' .DIRECTORY_SEPARATOR .'* ' .DIRECTORY_SEPARATOR .'Providers ' .DIRECTORY_SEPARATOR .'*Provider.php ' ;
70
- $ pattern2 = config ('modules.paths.modules ' ,
71
- 'Modules ' ).'/* ' .DIRECTORY_SEPARATOR .'* ' .DIRECTORY_SEPARATOR .'Providers ' .DIRECTORY_SEPARATOR .'Filament ' .DIRECTORY_SEPARATOR .'*Provider.php ' ;
68
+ $ pattern1 = config (
69
+ 'modules.paths.modules ' ,
70
+ 'Modules '
71
+ ) . '/* ' . DIRECTORY_SEPARATOR . '* ' . DIRECTORY_SEPARATOR . 'Providers ' . DIRECTORY_SEPARATOR . '*Provider.php ' ;
72
+ $ pattern2 = config (
73
+ 'modules.paths.modules ' ,
74
+ 'Modules '
75
+ ) . '/* ' . DIRECTORY_SEPARATOR . '* ' . DIRECTORY_SEPARATOR . 'Providers ' . DIRECTORY_SEPARATOR . 'Filament ' . DIRECTORY_SEPARATOR . '*Provider.php ' ;
72
76
$ serviceProviders = glob ($ pattern1 );
73
77
$ panelProviders = glob ($ pattern2 );
74
78
// dd($panelProviders);
@@ -92,8 +96,9 @@ public function autoDiscoverPanels(): void
92
96
$ cacheKey = 'filament-modules-panel-providers ' ;
93
97
$ ttl = 10 ; // 24 hours
94
98
$ modules = \Module::allEnabled ();
95
- $ panels = collect ($ modules )->flatMap (function (Module $ module ) {
96
- $ panelProviders = glob ($ module ->getExtraPath ('app/Providers/Filament ' ).'/*.php ' );
99
+ $ panels = collect ($ modules )->flatMap (function (Module $ module ) {
100
+ $ panelProviders = glob ($ module ->getExtraPath ('app/Providers/Filament ' ) . '/*.php ' );
101
+
97
102
return collect ($ panelProviders )->map (function ($ path ) {
98
103
return $ this ->app [Modules::class]->convertPathToNamespace ($ path );
99
104
})->toArray ();
@@ -125,7 +130,7 @@ public function packageBooted(): void
125
130
126
131
// Handle Stubs
127
132
if (app ()->runningInConsole ()) {
128
- foreach (app (Filesystem::class)->files (__DIR__ . '/../stubs/ ' ) as $ file ) {
133
+ foreach (app (Filesystem::class)->files (__DIR__ . '/../stubs/ ' ) as $ file ) {
129
134
$ this ->publishes ([
130
135
$ file ->getRealPath () => base_path ("stubs/modules/ {$ file ->getFilename ()}" ),
131
136
], 'modules-stubs ' );
@@ -219,44 +224,44 @@ protected function registerModuleMacros(): void
219
224
$ relativeNamespace = str_replace ('App \\' , '' , $ relativeNamespace );
220
225
$ relativeNamespace = str_replace ('App ' , '' , $ relativeNamespace );
221
226
$ relativeNamespace = trim ($ relativeNamespace , '\\' );
222
- $ relativeNamespace = '\\' . $ relativeNamespace ;
227
+ $ relativeNamespace = '\\' . $ relativeNamespace ;
223
228
224
229
return $ this ->namespace ($ relativeNamespace );
225
230
});
226
231
Module::macro ('appPath ' , function (string $ relativePath = '' ) {
227
232
$ appPath = $ this ->getExtraPath ('app ' );
228
233
229
- return $ appPath. ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
234
+ return $ appPath . ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
230
235
});
231
236
232
237
Module::macro ('databasePath ' , function (string $ relativePath = '' ) {
233
238
$ appPath = $ this ->getExtraPath ('database ' );
234
239
235
- return $ appPath. ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
240
+ return $ appPath . ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
236
241
});
237
242
238
243
Module::macro ('resourcesPath ' , function (string $ relativePath = '' ) {
239
244
$ appPath = $ this ->getExtraPath ('resources ' );
240
245
241
- return $ appPath. ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
246
+ return $ appPath . ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
242
247
});
243
248
244
249
Module::macro ('migrationsPath ' , function (string $ relativePath = '' ) {
245
250
$ appPath = $ this ->databasePath ('migrations ' );
246
251
247
- return $ appPath. ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
252
+ return $ appPath . ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
248
253
});
249
254
250
255
Module::macro ('seedersPath ' , function (string $ relativePath = '' ) {
251
256
$ appPath = $ this ->databasePath ('seeders ' );
252
257
253
- return $ appPath. ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
258
+ return $ appPath . ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
254
259
});
255
260
256
261
Module::macro ('factoriesPath ' , function (string $ relativePath = '' ) {
257
262
$ appPath = $ this ->databasePath ('factories ' );
258
263
259
- return $ appPath. ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
264
+ return $ appPath . ($ relativePath ? DIRECTORY_SEPARATOR . $ relativePath : '' );
260
265
});
261
266
}
262
267
}
0 commit comments