在我的Laravel 4.2项目中,我已将User模型移动到我的app目录中的新目录。
-app/
--Acme/
---Users/
----User.php
然后我删除了app / models目录
我将此添加到我的composer.json文件
"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"
}
},
我还编辑了我的app / auth.php文件
/*
|--------------------------------------------------------------------------
| 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',
然后我跑了composer dump-autoload
我现在正尝试使用Laravel Forge安装我的Github存储库,但我一直收到此错误:
...
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
有谁知道为什么会这样,以及如何解决?
答案 0 :(得分:2)
我从composer.json文件中的"app/models",
中删除了classmap
,现在可以使用了。{/ p>