问题
In my Laravel 4.2 project I have moved my User model to a new directory within my app directory.
-app/
--Acme/
---Users/
----User.php
I then removed the app/models directory
I added this to my composer.json file
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/Acme/adminHelpers.php"
],
"files": [
"app/Acme/helpers.php",
"app/Acme/adminHelpers.php"
],
"psr-4": {
"Acme\\": "app/Acme"
}
},
I also edited my app/auth.php file
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/
'model' => 'app\Acme\Users\User',
I then ran composer dump-autoload
I'm now trying to install my Github repository using Laravel Forge but I keep getting this error:
...
Writing lock file
Generating autoload files
[RuntimeException]
Could not scan for classes inside "app/models" which does not appear to be a file nor a folder
Does anyone know why this is happening and how to fix?
回答1:
I removed "app/models",
from classmap
inside the composer.json file and it now works.
来源:https://stackoverflow.com/questions/29424381/laravel-4-2-composer-install-error-could-not-scan-for-classes-inside-app-model