Am trying structure my app in such a way that all my models will be in a dedicated directory(in my case Classified). I created the directory with Laravel app directory and added it to my my composer.json file. Below is the structure of my composer.json file:
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"Classified\\": "app/",
"Classified\\": "app/Classified"
}
},
Then I run composer dump-autoload in my terminal but I keep getting "Key Classified\ is a duplicate in ./composer.json at line 29 " and when I tried viewing my app in the browser i get:
Fatal error: Uncaught exception 'ReflectionException' with message 'Class App\Http\Kernel does not exist' in /home/vagrant/Workspace/codulabproducts/classified/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 736.
Line 29 in my composer.json file is
"Classified\\": "app/Classified"
I don't know what am doing wrong because I have followed these steps in my other project and everything went well.
You can define more than one directory for a namespace prefix. But in that case the value for the key must be a list and not a string (see the second example in the documentation):
{
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"Classified\\": ["app/", "app/Classified"]
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With