Skip to content

Commit f92f3ab

Browse files
coolsam726github-actions[bot]
authored andcommitted
Fix styling
1 parent 65a6b96 commit f92f3ab

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

src/Commands/FileGenerators/ModulePanelProviderClassGenerator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,15 @@ protected function addPanelMethodToClass(ClassType $class): void
104104

105105
$this->configurePanelMethod($method);
106106
}
107+
107108
protected function addNavigationLabelMethodToClass(ClassType $class): void
108109
{
109110
$class->addMethod('getNavigationLabel')
110111
->setPublic()
111112
->setReturnType('string')
112113
->setBody($this->generateNavigationLabelMethodBody());
113114
}
115+
114116
protected function generateNavigationLabelMethodBody(): string
115117
{
116118
$navigationLabel = $this->navigationLabel;

src/Commands/ModuleMakeFilamentPanelCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
use Filament\Support\Commands\Concerns\CanGeneratePanels;
99
use Filament\Support\Commands\Concerns\CanManipulateFiles;
1010
use Filament\Support\Commands\Exceptions\FailureCommandOutput;
11-
use Illuminate\Support\Facades\App;
12-
use Illuminate\Support\ServiceProvider;
1311
use Illuminate\Support\Str;
1412
use Symfony\Component\Console\Input\InputArgument;
1513
use Symfony\Component\Console\Input\InputOption;
@@ -96,7 +94,7 @@ protected function ensureNavigationLabelOption(): void
9694
if (! $this->option('label')) {
9795
$label = text(
9896
label: 'What is the navigation label for the panel?',
99-
placeholder: Str::title($this->argument('id') ?? $this->getModule()->getName()." App"),
97+
placeholder: Str::title($this->argument('id') ?? $this->getModule()->getName() . ' App'),
10098
required: true,
10199
validate: fn (string $value) => empty($value) ? 'The navigation label cannot be empty.' : null,
102100
hint: 'This is used in the navigation to identify the panel.',

src/ModulesServiceProvider.php

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ public function packageRegistered(): void
6565
public function attemptToRegisterModuleProviders(): void
6666
{
6767
// 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';
7276
$serviceProviders = glob($pattern1);
7377
$panelProviders = glob($pattern2);
7478
// dd($panelProviders);
@@ -92,8 +96,9 @@ public function autoDiscoverPanels(): void
9296
$cacheKey = 'filament-modules-panel-providers';
9397
$ttl = 10; // 24 hours
9498
$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+
97102
return collect($panelProviders)->map(function ($path) {
98103
return $this->app[Modules::class]->convertPathToNamespace($path);
99104
})->toArray();
@@ -125,7 +130,7 @@ public function packageBooted(): void
125130

126131
// Handle Stubs
127132
if (app()->runningInConsole()) {
128-
foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) {
133+
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
129134
$this->publishes([
130135
$file->getRealPath() => base_path("stubs/modules/{$file->getFilename()}"),
131136
], 'modules-stubs');
@@ -219,44 +224,44 @@ protected function registerModuleMacros(): void
219224
$relativeNamespace = str_replace('App\\', '', $relativeNamespace);
220225
$relativeNamespace = str_replace('App', '', $relativeNamespace);
221226
$relativeNamespace = trim($relativeNamespace, '\\');
222-
$relativeNamespace = '\\'.$relativeNamespace;
227+
$relativeNamespace = '\\' . $relativeNamespace;
223228

224229
return $this->namespace($relativeNamespace);
225230
});
226231
Module::macro('appPath', function (string $relativePath = '') {
227232
$appPath = $this->getExtraPath('app');
228233

229-
return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
234+
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
230235
});
231236

232237
Module::macro('databasePath', function (string $relativePath = '') {
233238
$appPath = $this->getExtraPath('database');
234239

235-
return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
240+
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
236241
});
237242

238243
Module::macro('resourcesPath', function (string $relativePath = '') {
239244
$appPath = $this->getExtraPath('resources');
240245

241-
return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
246+
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
242247
});
243248

244249
Module::macro('migrationsPath', function (string $relativePath = '') {
245250
$appPath = $this->databasePath('migrations');
246251

247-
return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
252+
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
248253
});
249254

250255
Module::macro('seedersPath', function (string $relativePath = '') {
251256
$appPath = $this->databasePath('seeders');
252257

253-
return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
258+
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
254259
});
255260

256261
Module::macro('factoriesPath', function (string $relativePath = '') {
257262
$appPath = $this->databasePath('factories');
258263

259-
return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : '');
264+
return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
260265
});
261266
}
262267
}

0 commit comments

Comments
 (0)