Laravel 4.2 Composer install error: Could not scan for classes inside “app/models”

陌路散爱 提交于 2019-12-11 09:38:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!