Skip to content

Commit 55eb557

Browse files
committed
fix: Replace invalid askForLivewireComponentLocation method call
- Replace askForLivewireComponentLocation() with askForLivewireComponentNamespace() - Resolves BadMethodCallException when running make:filament-tree-widget command - Method was attempting to call non-existent askForLivewireComponentLocation from CanAskForLivewireComponentLocation trait Fixes #93
1 parent 06c2629 commit 55eb557

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

src/Commands/MakeTreePageCommand.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ public function handle(): int
139139
$this->configurePagesLocation();
140140

141141
$this->configureLocation();
142-
// dd($this);
143142

144143
$this->createCustomPage();
145144
// $this->createPage();
@@ -155,6 +154,10 @@ public function handle(): int
155154
// }
156155

157156
} catch (FailureCommandOutput) {
157+
return static::FAILURE;
158+
} catch (\Throwable $e) {
159+
$this->components->error("Failed to create Filament tree page [{$this->fqn}]: {$e->getMessage()}");
160+
158161
return static::FAILURE;
159162
}
160163

@@ -229,11 +232,11 @@ protected function configureModel(): void
229232
$this->modelFqnEnd = class_basename($this->modelFqn);
230233
}
231234

232-
if ($this->option('model')) {
233-
$this->callSilently('make:model', [
234-
'name' => $this->modelFqn,
235-
]);
236-
}
235+
// if ($this->option('model')) {
236+
// $this->callSilently('make:model', [
237+
// 'name' => $this->modelFqn,
238+
// ]);
239+
// }
237240
}
238241

239242
protected function configureHasResource(): void

src/Commands/MakeTreeWidgetCommand.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace SolutionForest\FilamentTree\Commands;
44

5+
use Filament\Support\Commands\Concerns\CanAskForLivewireComponentLocation;
56
use Filament\Support\Commands\Concerns\CanAskForResource;
67
use Filament\Support\Commands\Concerns\CanManipulateFiles;
78
use Filament\Support\Commands\Concerns\HasCluster;
@@ -30,6 +31,7 @@
3031
)]
3132
class MakeTreeWidgetCommand extends Command
3233
{
34+
use CanAskForLivewireComponentLocation;
3335
use CanAskForResource;
3436
use CanCheckFileGenerationFlags;
3537
use CanManipulateFiles;
@@ -133,6 +135,10 @@ public function handle(): int
133135

134136
$this->createCustomWidget();
135137
} catch (FailureCommandOutput) {
138+
return static::FAILURE;
139+
} catch (\Throwable $e) {
140+
$this->components->error("Failed to create Filament tree widget [{$this->fqn}]: {$e->getMessage()}");
141+
136142
return static::FAILURE;
137143
}
138144

@@ -198,11 +204,11 @@ protected function configureModel(): void
198204
$this->modelFqnEnd = class_basename($this->modelFqn);
199205
}
200206

201-
if ($this->option('model')) {
202-
$this->callSilently('make:model', [
203-
'name' => $this->modelFqn,
204-
]);
205-
}
207+
// if ($this->option('model')) {
208+
// $this->callSilently('make:model', [
209+
// 'name' => $this->modelFqn,
210+
// ]);
211+
// }
206212
}
207213

208214
protected function configureHasResource(): void

0 commit comments

Comments
 (0)