Skip to content
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

[Bug]: #92

Closed
Mike-Hawwke opened this issue Apr 19, 2024 · 19 comments · Fixed by #98
Closed

[Bug]: #92

Mike-Hawwke opened this issue Apr 19, 2024 · 19 comments · Fixed by #98
Labels
bug Something isn't working

Comments

@Mike-Hawwke
Copy link

What happened?

Hello,

I have installed your plugin in my Filament v3 (Laravel 11) installation.
When I do -> php artisan module:make:filament-resource (Document) and I generate the resource, I get an error that appears:

Class "Modules/Document/Providers/DocumentServiceProvider" not found

If I move the provider folder to the root of the plugin folder, it works.

But the new resource does not appear in the Filament menus after generating the model and migration.

thx

How to reproduce the bug

Basic installation with latest version of laravel and module
follow the installation steps

Package Version

v4.x

PHP Version

8.2

Laravel Version

11

Which operating systems does with happen with?

No response

Notes

No response

@Mike-Hawwke Mike-Hawwke added the bug Something isn't working label Apr 19, 2024
@coolsam726
Copy link
Contributor

That's strange, kindly show me the exact command that you ran and you modules structure.
Also, let me know if you published the module's configs or not, for ease of reproduction.

@Mike-Hawwke
Copy link
Author

the command
composer require coolsam/modules
php artisan vendor:publish --tag="modules-config"
php artisan module:make Document
php artisan module:filament:install Document
php artisan module:make:filament-resource
name model Document

I only have this module at the moment
and I stopped at the step where I generate my resource

I am attaching a screen of the config file of your plugin and the error

2024-04-19 140300
2024-04-19 140101

@coolsam726
Copy link
Contributor

I see. Just curious, did you go through the following process?
image
This module depends on nwidart/laravel-modules being configured and working properly. If you didn't go through its documentation, you might have missed a step which ensures modules are auto-discovered by the parent app.
I am specifically suspecting this part of the documetation:
image

@coolsam726 coolsam726 removed the bug Something isn't working label Apr 19, 2024
@Mike-Hawwke
Copy link
Author

Mike-Hawwke commented Apr 19, 2024

the extra is in the composer.json (see screen)

2024-04-19 144156

@coolsam726
Copy link
Contributor

I am afraid I cannot reproduce the error, I even created an app from scratch just to try and reproduce, but it is working fine.
image
However, I noticed from your screenshot that you are using windows. I don't have a windows machine and I always develop on Linux, so it is possible that this bug occurs on Windows. Can someone else confirm this?

@Mike-Hawwke
Copy link
Author

Can you give me access to this project to see the differences between yours and mine?

@coolsam726 coolsam726 added the bug Something isn't working label Apr 19, 2024
@coolsam726
Copy link
Contributor

coolsam726 commented Apr 19, 2024

I didn't push it to a repo yet. However, I wrote a test to check the convertPathToNamespace method which seems to be the cause of your failure, and the test is passing on linux but failing on windows, so I can almost certainly confirm that this is a bug with the function on the windows platform.
image
Let me attempt a fix and update you.

@coolsam726
Copy link
Contributor

All Tests now give a good indicator. Please try v4.0.3 and report if it fixes your issue. This is a windows directory separator related issue.

@Mike-Hawwke
Copy link
Author

Thank you for your intervention

After udpate of the module I carried out the commands

php artisan module:make Document
I first had an error at the same step but it was different and referred to a problem with Nwidart

I did some research and came across this
nWidart/laravel-modules#4

So I applied the modification to config/models.php in the generator

The error disappeared so I performed the second command

php artisan module:filament:install Document

A second error has occurred
https://flareapp.io/share/x7XaAzY5

I will share my progress with you if I find the reason

@Mike-Hawwke
Copy link
Author

When trying to create the resource I got this error (see screen)
2024-04-19 180329

I wonder while searching there I came across
getModulePlugins

This one also contains a path, possible that the problem is linked to Windows as above?

@coolsam726
Copy link
Contributor

When trying to create the resource I got this error (see screen) 2024-04-19 180329

I wonder while searching there I came across getModulePlugins

This one also contains a path, possible that the problem is linked to Windows as above?

It is definitely a bug only with windows, my methods are mixing up DIRECTORY SEPARATORS. I think I will have to setup a dev environment on Windows so that I can re-test the entire package to ensure each command works on windows.

@thexaib
Copy link

thexaib commented Apr 19, 2024

I am getting same error on MacOS 14.3.1 for filament-modules:4.0.3 , when plugins are registered by ModulesPlugin::make() , it throws error. My module from nWidart/laravel-modules is working fine if ModulesPlugin::make() is NOT called
everything worked when using filament-modules:4.0.2
Error:

 Class "Modules\Consents\app\Filament\ConsentsPlugin" not found

  at vendor/coolsam/modules/src/ModulesPlugin.php:22
     18▕         $panel
     19▕             ->topNavigation(config('filament-modules.clusters.enabled', false) && config('filament-modules.clusters.use-top-navigation', false));
     20▕         $plugins = $this->getModulePlugins();
     21▕         foreach ($plugins as $modulePlugin) {
  ➜  22▕             $panel->plugin($modulePlugin::make());
     23▕         }
     24▕     }
     25▕ 
     26▕     public function boot(Panel $panel): void

      +2 vendor frames 

  3   app/Providers/Filament/SupervisorPanelProvider.php:81
      Filament\Panel::plugins()
      +35 vendor frames 

  39  [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Filament\FilamentServiceProvider))

@coolsam726
Copy link
Contributor

Please try v4.0.4 and confirm to me that it fixes the issue. Thanks.

@thexaib
Copy link

thexaib commented Apr 20, 2024

Working Now. Thanks

@coolsam726
Copy link
Contributor

Thanks for the feedback @thexaib. If you experience any other issues, don't hesitate to post them.

@Mike-Hawwke
Copy link
Author

Hi @coolsam726 ,

I still have problems with your code

For reasons of simplicity I took a server directly and did the installation on it
But I still end up with the same kind of error

I don't understand where the problem comes from

2024-04-22 122207
2024-04-22 122242

Thank you for your help

@Mike-Hawwke
Copy link
Author

I can't solve the problem, can you help me @coolsam726 ?

Here's where I'm stuck

I am now on server
When I do the installation no problem
I create my module
but when I want to install it I get this error that appears
2024-04-22 163017

@coolsam726
Copy link
Contributor

@Mike-Hawwke Do you mind sharing a public repo of your code so that I can reproduce the error and try to help?

@coolsam726
Copy link
Contributor

Closing for now till I hear back from you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants