-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Widget Command Livewire Path Solution #15871
Conversation
Hi @ksaif534, I have tried the solution you provided, but it seems the generated namespace is not correct.
❯ php artisan make:filament-widget PaymentChart --chart --resource=PaymentResource
┌ Where would you like to create this? ────────────────────────┐
│ [App\Livewire] alongside other Livewire components │
└──────────────────────────────────────────────────────────────┘
┌ Which type of chart would you like to create? ───────────────┐
│ Bar chart │
└──────────────────────────────────────────────────────────────┘
INFO Filament widget [app/Livewire/PaymentChart.php] created successfully.
INFO Make sure to register the widget in `PaymentResource::getWidgets()`, and then again in `getHeaderWidgets()` or `getFooterWidgets()` of any `PaymentResource` page. ❯ bat app/Livewire/PaymentChart.php
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: app/Livewire/PaymentChart.php
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ <?php
2 │
3 │ namespace \PaymentResource\Widgets;
4 │
5 │ use Filament\Widgets\ChartWidget;
6 │
7 │ class PaymentChart extends ChartWidget
8 │ {
9 │ protected static ?string $heading = 'Chart';
10 │
11 │ protected function getData(): array
12 │ {
13 │ return [
14 │ //
15 │ ];
16 │ }
17 │
18 │ protected function getType(): string
19 │ {
20 │ return 'bar';
21 │ }
22 │ }
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── |
@fathurrohman26 Oh, I didn't notice that. I'll try to fix it. |
I did remove the test since there is a new style of tests in v4 and this would not work being merged in to that |
@fathurrohman26 @danharrin I've adjusted the changes and fixed the problems in the initial solution. It'd be great if you can provide feedback. Adjusted PR: #15910 |
Hello.
This is a solution to this Github issue: https://github.com/filamentphp/filament/issues/14637
Description
When the make:filament-widget command is run to create a new widget and the resource is provided and when the user selects [App\Livewire] alongside other Livewire components after selecting Table from the first prompt, a file permission error was thrown and the directory was not being created. The solution now creates a new file TestWidget.php within the app/Livewire directory when it's prompted by the user.
Visual Changes
After the Solution:
Before the Solution:
Functional Changes
I've fixed the style with the composer cs command, the file changes have been tested.