nWidart / laravel-modules

Module Management In Laravel
https://docs.laravelmodules.com
MIT License
5.5k stars 954 forks source link

component not found (name space ) #1944

Open sinadotnut opened 2 weeks ago

sinadotnut commented 2 weeks ago

Versions:

Description:

in the confing/module.php , app path section , there is a setting that specify the app_folther path , but the problem is when this path is lowercase , the name space of any class that create in the app folder is not correctly formed and you need to turn if from : 'app_folder' => '/app', to : 'app_folder' => '/App', in order to new class have name sspace . and finaly change the app in the module to App

Steps To Reproduce:

alissn commented 2 weeks ago

Hi @sinadotnut,

To resolve the issue, you can update your configuration as follows:

In the modules.paths.generator section of your config, make the following changes:

Here’s an example:

'actions'         => ['path' => 'App/Actions', 'namespace' => 'App/Actions', 'generate' => false],
'casts'           => ['path' => 'App/Casts', 'namespace' => 'App/Casts', 'generate' => false],
'channels'        => ['path' => 'App/Broadcasting', 'namespace' => 'App/Broadcasting', 'generate' => false],
'class'           => ['path' => 'App/Classes', 'namespace' => 'App/Classes', 'generate' => false],
'command'         => ['path' => 'App/Console', 'namespace' => 'App/Console', 'generate' => false],
'component-class' => ['path' => 'App/View/Components', 'namespace' => 'App/View/Components', 'generate' => false],
'emails'          => ['path' => 'App/Emails', 'namespace' => 'App/Emails', 'generate' => false],
'event'           => ['path' => 'App/Events', 'namespace' => 'App/Events', 'generate' => false],
'enums'           => ['path' => 'App/Enums', 'namespace' => 'App/Enums', 'generate' => false],
'exceptions'      => ['path' => 'App/Exceptions', 'namespace' => 'App/Exceptions', 'generate' => false],
'jobs'            => ['path' => 'App/Jobs', 'namespace' => 'App/Jobs', 'generate' => false],
'helpers'         => ['path' => 'App/Helpers', 'namespace' => 'App/Helpers', 'generate' => false],
'interfaces'      => ['path' => 'App/Interfaces', 'namespace' => 'App/Interfaces', 'generate' => false],
'listener'        => ['path' => 'App/Listeners', 'namespace' => 'App/Listeners', 'generate' => false],
'model'           => ['path' => 'App/Models', 'namespace' => 'App/Models', 'generate' => false],
'notifications'   => ['path' => 'App/Notifications', 'namespace' => 'App/Notifications', 'generate' => false],
'observer'        => ['path' => 'App/Observers', 'namespace' => 'App/Observers', 'generate' => false],
'policies'        => ['path' => 'App/Policies', 'namespace' => 'App/Policies', 'generate' => false],
'provider'        => ['path' => 'App/Providers', 'namespace' => 'App/Providers', 'generate' => true],
'repository'      => ['path' => 'App/Repositories', 'namespace' => 'App/Repositories', 'generate' => false],
'resource'        => ['path' => 'App/Transformers', 'namespace' => 'App/Transformers', 'generate' => false],
'route-provider'  => ['path' => 'App/Providers', 'namespace' => 'App/Providers', 'generate' => true],
'rules'           => ['path' => 'App/Rules', 'namespace' => 'App/Rules', 'generate' => false],
'services'        => ['path' => 'App/Services', 'namespace' => 'App/Services', 'generate' => false],
'scopes'          => ['path' => 'App/Models/Scopes', 'namespace' => 'App/Models/Scopes', 'generate' => false],
'traits'          => ['path' => 'App/Traits', 'namespace' => 'App/Traits', 'generate' => false],

This should help resolve the namespace issue you're encountering. Let me know if you need further assistance!

sinadotnut commented 2 weeks ago

thanks , but it didnt help . The major issue I'm facing is that when I have this property in my config/module.php file:

'app_folder' => '/app',

my Livewire components don't work properly. When I use Livewire actions, I encounter a Symfony error stating that the component is not found. I figured out that when I comment out this part of the config file, my Livewire actions work properly.