找不到Laravel 5用户模型 [英] Laravel 5 User Model not found

查看:76
本文介绍了找不到Laravel 5用户模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将用户模型从默认应用程序目录移至应用程序/模型.

I have moved the User model from the default app directory into app/Models.

我已将用户中的命名空间更新为namespace App\Models;,但出现此错误:

I have updated the namespace in User to namespace App\Models; but I am getting this error:

FatalErrorException in EloquentUserProvider.php line 122:
Class '\App\User' not found

我在json文件中有正确的条目:

I have the correct entry in my json file:

"autoload": {
    "classmap": [
        "database",
        "app/Modules",
        "app/Models"
    ],
    "psr-4": {
        "App\\": "app/",
        "Modules\\": "app/Modules/"
    }
},

我错过了什么?

推荐答案

您需要更新 config/auth.php 文件.将'model' => 'App\User'更改为'model' => 'App\Models\User'.

You need to update your config/auth.php file. Change 'model' => 'App\User' to 'model' => 'App\Models\User'.

这篇关于找不到Laravel 5用户模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆