savannabits / filament-modules

Integration of Filament with nWidart/laravel-modules: Create independent Filament Files for each Laravel Module
https://filamentphp.com/plugins/coolsam-modules
MIT License
109 stars 22 forks source link

[Bug]: Provider not found #106

Closed nickxhinobi closed 4 months ago

nickxhinobi commented 4 months ago

What happened?

"Modules\Booking\Providers\BookingServiceProvider" not found

I believe the path is wrong as I see the log, it was created at /Modules/Booking/app/Providers/BookingServiceProvider.php

How to reproduce the bug

When I first create the module by running this php artisan module:make Booking

It creates successfully, I notice the file was being created here Generating file C:/Users/XXXX/test/Modules/Booking/app/Providers/BookingServiceProvider.php 1.00ms DONE

Then after I ran this command php artisan module:filament:install Booking

The error Modules\Booking\Providers\BookingServiceProvider not found came out due it was created at /Modules/Booking/app/Providers/BookingServiceProvider.php instead

Here is the sample error I got it

vendor\coolsam\modules\src\ModulesServiceProvider.php:74 Illuminate\Foundation\Application::register()

Package Version

4

PHP Version

8.2

Laravel Version

11

Which operating systems does with happen with?

Windows

Notes

No response

agostinofiscale commented 4 months ago

Hi dude!

I just went through the same problem, to fix this you have to follow the autoloading instructions from https://github.com/nWidart/laravel-modules.

By the default the modules are not loaded automatically so your autoloader doesn't know about them, what you have to do is to the following "merge-plugin" key in your "extra" key in your composer.json

"extra": { "laravel": { "dont-discover": [] }, "merge-plugin": { "include": [ "Modules/*/composer.json" ] } },

then execute the 'composer dump-autoload' and you should be fine.

nickxhinobi commented 4 months ago

Hi dude!

I just went through the same problem, to fix this you have to follow the autoloading instructions from https://github.com/nWidart/laravel-modules.

By the default the modules are not loaded automatically so your autoloader doesn't know about them, what you have to do is to the following "merge-plugin" key in your "extra" key in your composer.json

"extra": { "laravel": { "dont-discover": [] }, "merge-plugin": { "include": [ "Modules/*/composer.json" ] } },

then execute the 'composer dump-autoload' and you should be fine.

Cool, it works! Thanks.