@@ -16,7 +16,7 @@ class {{ class }} extends PackageServiceProvider
16
16
{
17
17
$package->name(static::$name)
18
18
->hasViews(static::$viewNamespace)
19
- ->hasConsoleCommands ($this->getCommands())
19
+ ->hasCommands ($this->getCommands())
20
20
->hasInstallCommand(function (InstallCommand $command) {
21
21
$command
22
22
->askToRunMigrations()
@@ -48,7 +48,7 @@ class {{ class }} extends PackageServiceProvider
48
48
{
49
49
// Get an array of file names from the migrations directory
50
50
$glob1 = glob($this->package->basePath('/../database/migrations/*.php'));
51
- $glob2 = glob($this->package->basePath('/../database/migrations/*.php.stub '));
51
+ $glob2 = glob($this->package->basePath('/../database/migrations/**/* .php'));
52
52
53
53
return collect($glob1)
54
54
->merge($glob2)
@@ -65,7 +65,10 @@ class {{ class }} extends PackageServiceProvider
65
65
// automatically include all namespace classes in the Console directory
66
66
// use glob to return full paths to all files in the Console directory
67
67
68
- $paths = glob($this->package->basePath('/Console/*.php'));
68
+ $paths = array_merge(
69
+ glob($this->package->basePath('/Console/Commands/*.php')),
70
+ glob($this->package->basePath('/Console/Commands/**/*.php'))
71
+ );
69
72
70
73
return collect($paths)
71
74
->map(fn ($filename) => $this->getNamespaceFromFile($filename)->toString())
@@ -74,15 +77,15 @@ class {{ class }} extends PackageServiceProvider
74
77
75
78
private function getNamespaceFromFile($path): Stringable
76
79
{
77
- return $this->getFullNamespace(Str::of($path)->afterLast('src /')
80
+ return $this->getFullNamespace(Str::of($path)->afterLast('app /')
78
81
->replace('/', '\\')
79
82
->studly()->rtrim('.php'));
80
83
}
81
84
82
85
private function getFullNamespace(string $relativeNamespace = ''): Stringable
83
86
{
84
87
return Str::of(static::$name)->studly()
85
- ->prepend('Vanadi \\')
88
+ ->prepend(trim(config('modular.namespace','Modules'),'\\').' \\')
86
89
->append('\\')
87
90
->append(Str::studly($relativeNamespace));
88
91
}
0 commit comments