From 417dc49b5b6cdaf1da47767dff2103cdf8373a94 Mon Sep 17 00:00:00 2001 From: Hugh Messenger Date: Mon, 2 Oct 2023 19:54:13 -0500 Subject: [PATCH] Fix select() issue in MakeWidgetCommand --- packages/widgets/src/Commands/MakeWidgetCommand.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/widgets/src/Commands/MakeWidgetCommand.php b/packages/widgets/src/Commands/MakeWidgetCommand.php index 4e0cae15e0..9c05f5b8a8 100644 --- a/packages/widgets/src/Commands/MakeWidgetCommand.php +++ b/packages/widgets/src/Commands/MakeWidgetCommand.php @@ -74,6 +74,7 @@ class MakeWidgetCommand extends Command if (! $panel) { $panels = Filament::getPanels(); + $namespace = config('livewire.class_namespace'); /** @var ?Panel $panel */ $panel = $panels[select( @@ -83,8 +84,8 @@ class MakeWidgetCommand extends Command fn (Panel $panel): string => "The [{$panel->getId()}] panel", $panels, ), - '' => '[App\\Livewire] alongside other Livewire components', - ]), + $namespace => "[{$namespace}] alongside other Livewire components", + ]) )] ?? null; } } @@ -95,8 +96,8 @@ class MakeWidgetCommand extends Command $resourceNamespace = null; if (! $panel) { - $path = app_path('Livewire/'); - $namespace = 'App\\Livewire'; + $namespace = config('livewire.class_namespace'); + $path = app_path(Str::of($namespace)->after('App\\')->replace('\\', '/')->toString()); } elseif ($resource === null) { $widgetDirectories = $panel->getWidgetDirectories(); $widgetNamespaces = $panel->getWidgetNamespaces();