I'd like to say this is nice module.
It has an error that says afte creating Backend module.
Class 'CustomNameSpace\Backend\Providers\BackendServiceProvider' not found.
L v5.2.39
It looks like it couldn't find your namespace. Double check if the case on CustomNameSpace is the same everywhere.
Also try with the default Modules namespace to see if we can pinpoint the issue.
Hi,
I have changed namespace to default "Modules" uppercase "M", I still got the same issue.
Class 'Modules\Backend\Providers\BackendServiceProvider' not found
Changing the namespace alone won't do anything, as it's PSR-4, your folder structure needs to match, or your composer.json file needs to be adapted.
This is composer.json on root directory
"psr-4": { "App\\": "app/", "Modules\\": "modules/" }
Am I missing anything!
You need to check the namespaces yes.
The folder structure needs to match the namespace.
"psr-4": { "App\\": "app/", "Modules\\": "modules/" }
- Folder stucture trace to BackendServiceProvider as follows:
/modules/Backend/Providers/BackendServiceProvider.php
- namespace declaration in BackendServiceProvider.php
- composer.json content for Backend module as related to psr-4:
"autoload": {
"psr-4": {
"Modules\Backend\": ""
}
}
You just linked 2 different psr-4 autoload section. You can only use one of them, keep the first one.
Also run a composer dumpautoload and php artisan clear-compiled.
Thanks! That fixed it!
Awesome 馃憤
Most helpful comment
You just linked 2 different psr-4 autoload section. You can only use one of them, keep the first one.
Also run a
composer dumpautoloadandphp artisan clear-compiled.